Multiple Hero Buttons
Support Area › Forums › Elite › Multiple Hero Buttons
Tagged: HERO, hero buttons, Layout, multiple hero buttons
- This topic has 7 replies, 2 voices, and was last updated 9 years, 8 months ago by Bill Robbins.
-
AuthorPosts
-
July 30, 2014 at 07:53 #21285kevin daviesParticipant
Bill,
Me again, two questions in one day!
Is it possible to add multiple hero buttons to a top hero section on a per page basis. So for example, add two more buttons horizontally alongside the existing one and centre them all?
Thank,
KevinJuly 30, 2014 at 09:33 #21288Bill RobbinsModeratorHello Kevin,
You could do that with a bit of editing. Here’s what you’ll need to do.
- Go to the Appearance section in your WordPress dashboard and choose Edit.
- From the list of files on your right, choose hero-options.php and find this spot (starts on line 134)
<div class="hero-button-holder"> <a class="button hero" href="<?php echo get_post_meta($post->ID, "hero_button_url", TRUE); ?>"><?php echo get_post_meta($post->ID, "hero_button_text", TRUE); ?></a> </div>
- Change that to be like this:
(Be sure to copy that code from the support site directly and not the notification email).
- Save your changes.
- Next go to the page where you’d like to have two buttons and edit it. Look in the top right hand corner for the “Screen Options” tab and click on it. Check the box next to custom fields and then close the screen options.
- Scroll down below the main content box until you find the custom fields section. This is where we’ll enter the information for the new button.
- In the spot on the left, the one called “Name” enter this:
hero_button_text_2
and in the spot on the right, called “Value” enter the text you’d like your button to say. Then click the “Add Custom Field Button.”
To add the URL, enter this in the name:
hero_button_url_2
and then in the “Value” enter the URL you’d like your new button to link to. Then add that custom field.
Once a new custom filed has been manually added, you’ll be able to select it from the drop-down menu in the future instead of having to type them.
- Update your page.
That should give you a new button spot for your hero section. If you have any questions or trouble, let me know.
Thanks,
BillJuly 30, 2014 at 12:39 #21295kevin daviesParticipantBill that looks great but I would like to have three buttons and also have them open in a new page if possible….
Sorry for the strange requests! ;o)
Thanks,
kevinJuly 30, 2014 at 12:54 #21296Bill RobbinsModeratorOk. That’s possible too. Instead of the snippet above, use this one:
The idea is the same. Just now there is a possibility of a third button using these custom fields:
hero_button_url_3
andhero_button_text_3
to fill in the information for the third button. They are all set to open in new tabs/windows too.Have fun,
BillJuly 30, 2014 at 15:49 #21301kevin daviesParticipantouch it really doesn’t like that, I get a parse error for the site. Any thoughts. I have been able to revert back to two buttons to remove the error but it just didn’t like the change.
Appreciate your patience Bill.
Kevin
July 30, 2014 at 18:30 #21304Bill RobbinsModeratorTrying that from my phone wasn’t a good option. Try replacing the whole hero-options.php file with this:
I just gave that a quick test on my laptop and it seems to work. Let me know if you get stuck Kevin.
July 31, 2014 at 04:43 #21318kevin daviesParticipantThat’s great thanks Bill, the buttons have now appeared yet two of them seem to be merged together? There is a sperator line between buttons one and two but buttons two and three are merged. Also, is it possible to make them all a fixed width with the text centred?
Appreciate your help as always.
kevin
July 31, 2014 at 22:06 #21348Bill RobbinsModeratorKevin,
It’s likely possible to change the spacing around the buttons. Give this a try first and see if it does the trick.
- Go to your theme options page and choose the Advanced tab.
- Scroll down to the Custom CSS box and add this:
.hero-button-holder a.button { display: inline-block; margin-left: 5px; margin-right: 5px; }
- Update your settings.
That should give each button 5 pixels of margin on both the left and the right. If that doesn’t do the trick let me know and if possible, send over a URL to where you’re using multiple buttons so I can take a closer look for you.
Thanks,
Bill -
AuthorPosts
- The topic ‘Multiple Hero Buttons’ is closed to new replies.