Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to create a custom button and place under the Home Top 1 area in Enterprise?
Tagged: custom button, Enterprise, Home Top #1
- This topic has 7 replies, 2 voices, and was last updated 9 years, 9 months ago by mila.
-
AuthorPosts
-
July 2, 2014 at 7:39 pm #112751milaMember
Hi,
How do I create a custom text button and place it under the Home Top #1 area in the Enterprise child theme? I imagine that a text button should not be a difficult code... but I'm not a programmer; however, can cut'n paste.
Also, no matter how many Text widgets I add to the Home Top #1 area, it places them all in the upper left corner. (I suspect that I would have to add code to a Text widget?) I need to display this button under the WP-sider plugin, float right.
Thanks!!
http://www.diamondmindinternational.com/
MilaJuly 2, 2014 at 11:53 pm #112783Brad DaltonParticipantYou could add it 3 ways.
1. Hard code it directly into the front-page.php file
2. Hook it in from functions.php
3. Add it to a text widget after your Home Top widgetHere's the HTML for a standard button http://wpsites.net/web-design/add-icons-to-buttons-in-wordpress-themes/
July 3, 2014 at 8:21 pm #112916milaMemberBrad - i tried #3 but no matter how I configure it, it places a widget at the top left corner, overexposing it on top of my image. It probably inherits some properties from somewhere... I don't know how/where to change it.
for #2 Hook it from functions.php: the code examples for a standard button are in HTML. How do I imbed it in the functions.php? What is the exact syntax?
Thanks!!!
MilaJuly 3, 2014 at 11:32 pm #112927Brad DaltonParticipantJuly 4, 2014 at 8:32 pm #113014milaMemberBrad - thanks for this link. I inserted the code inside the functions.php where I want it, i.e. after the Home Top 1 and before Home Middle 1. Nothing happens. I don't the button... Here's a snippet of the code from functions.php:
/** Register widget areas */
genesis_register_sidebar( array(
'id' => 'home-top-1',
'name' => __( 'Home Top #1', 'enterprise' ),
'description' => __( 'This is home top #1 section.', 'enterprise' ),
) );/*** NEW: Button Book Mila Diamond ***/
add_action( 'genesis_before_loop', 'wpsites_hook_button', 25 );
function wpsites_hook_button() {
if ( is_front_page() ) {
echo'<div class="custom-button">';
echo'Book Mila Diamond';
echo'</div>';
}
}
/*** END OF NEW: Button Book Mila Diamond ***/genesis_register_sidebar( array(
'id' => 'home-middle-1',
'name' => __( 'Home Middle #1', 'enterprise' ),
'description' => __( 'This is home middle #1 section.', 'enterprise' ),
) );Thanks! Mila
July 4, 2014 at 9:01 pm #113015Brad DaltonParticipantThe code on my site is tested and works perfectly.
Placement in the functions file has no effect on output position which is controlled by hooks.
July 5, 2014 at 1:44 pm #113064milaMemberBrad, I assume you refer to Genesis Simple Hooks? What code do I put in the Hooks?
Thanks!
MilaJuly 5, 2014 at 2:06 pm #113065milaMemberBrad -
Q1. if placement in functions.php has no effect on the output, then what's a point of including it in the functions.php?
Q2. I need this button in the area BETWEEN the Home Top 1 and Home Middle 1, aligned to the right side of the page. It must be outside of the content wrapper (i.e. Top Middle 1) - showing just against the background image. When I put a simple button code in the Genesis Simple Hooks - in the genesis_before_content_sidebar_wrap, it is places inside the wrap instead...Please help.
Thanks,
Mila -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.