Community Forums › Forums › Archived Forums › Design Tips and Tricks › Move function from home.php to functions.php
- This topic has 5 replies, 2 voices, and was last updated 11 years, 2 months ago by Brad Dalton.
-
AuthorPosts
-
February 7, 2013 at 1:23 am #18590devindayMember
I am using the new executive theme located at turningpointehomes.com. The customer did not want to use the layout that came with the home.php layout. (I am using a static page for the homepage and not the home.php page that came with the theme)
There is one section that the customer did want though. the Call the action section. (see screenshot)
http://turningpointehomes.com/wp-content/uploads/2013/02/skitched-20130206-231630.jpg
I am wondering how I can modify the call to action function that is in the home.php and create a new one for the functions.php page that allows me to insert the CTA widget as in the theme demo and have it show up on the current static homepage just above the footer.
Hope this made sense. Been trying to do this myself for a couple hours, but havent made much progress.
Thanks for looking.
February 7, 2013 at 1:41 am #18593Brad DaltonParticipantBrian Gardner has written a very easy to follow tutorial which you can use for this: http://www.briangardner.com/welcome-text-widget/
Change the code to something like this:
add_action( 'genesis_before_footer', 'custom_welcome_text' ); function custom_welcome_text() { genesis_widget_area( 'welcome-text', array( 'before' => '<div class="welcome-text widget-area">', ) ); }
You could add a conditional tag to this code if you want to display the widget content on the home page only or you can simply install the Widget Logic plugin and add is_home() to the widget logic field.
February 8, 2013 at 3:43 pm #19078devindayMemberHi Brad,
Thank you for your reply! OK, I have read your post and also reviewed brian's post. Here is what I came up with.
1. Registered New CTA widget area
genesis_register_sidebar( array(
'id' => 'welcome-cta',
'name' => __( 'Welcome CTA', 'executive' ),
'description' => __( 'This is the welcome cta widget.', 'executive' ),
) );
2. Added the following function to functions.php
/** Add the welcome CTA section */
add_action( 'genesis_before_footer', 'custom_welcome_cta' );function custom_welcome_cta() {
if (is_home() ) {
genesis_widget_area( 'welcome-cta', array(
'before' => '',
) );
}
}
3. I referenced the div class in the above function to call the same CSS from the original theme call to action widget CSS
This code is live now on the site, but my CTA widget is showing up on the home before the footer.
Thoughts?
February 8, 2013 at 3:45 pm #19079devindayMemberHi Brad, Thank you for your reply! OK, I have read your post and also reviewed brian's post. Here is what I came up with.
1. Registered New CTA widget area
genesis_register_sidebar( array( 'id' => 'welcome-cta', 'name' => __( 'Welcome CTA', 'executive' ), 'description' => __( 'This is the welcome cta widget.', 'executive' ), ) );
2. Added the following function to functions.php
/** Add the welcome CTA section */ add_action( 'genesis_before_footer', 'custom_welcome_cta' ); function custom_welcome_cta() { if (is_home() ) { genesis_widget_area( 'welcome-cta', array( 'before' => '
', ) ); } }3. I referenced the div class in the above function to call the same CSS from the original theme call to action widget CSS This code is live now on the site, but my CTA widget is showing up on the home before the footer.
Thoughts?
February 8, 2013 at 3:47 pm #19082devindayMemberSorry the post was messed up. How did you properly add the code in your post? I put the code brackets around my, but the formatting went to crap.
February 8, 2013 at 9:54 pm #19159Brad DaltonParticipantUse square brackets in the text editor with the name of the code inside.
Change the conditional tag to this if (is_page(007) and add the post. i.d for that page
Change the hook to whereever you want the widget area:
Example: add_action( 'genesis_before_content')
If you could install the Genesis Simple Hooks plugin and paste in some text exactly where you want the widget content to ouput, i will write the code for you.
Example code: http://pastebin.com/RZZAsxdQ
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.