Community Forums › Forums › Archived Forums › Design Tips and Tricks › Widget area below featured article in eleven40
- This topic has 9 replies, 2 voices, and was last updated 10 years, 2 months ago by Brad Dalton.
-
AuthorPosts
-
July 3, 2014 at 12:46 am #112789michaeloeserMember
Hi everyone,
I wonder how I can place a widget area right below the first (featured) article on the grid homepage of eleven40. I have one featured article followed by a two-column grid. I like the widget area display right after the frist article.
I know how to setup widget areas and how to implement them in general but I can´t find a way to integrate a widget area after the featured article in eleven40. I assume there must be a hook or filter but I haven´t found it.
Cheers
MichaelJuly 3, 2014 at 1:04 am #112792Brad DaltonParticipantYou can hard code it into the front-page.php file or hook it in using a custom function. http://wpsites.net/web-design/adding-new-widget-areas-in-studiopress-themes/
July 3, 2014 at 1:18 am #112795michaeloeserMemberHi Brad,
thanks for the quick reply. That´s exactly what I thought I should do but I´m confused. See the code of my child themes home.php
<?php remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'eleven40_grid_loop_helper' ); /** Add support for Genesis Grid Loop */ function eleven40_grid_loop_helper() { if ( function_exists( 'genesis_grid_loop' ) ) { genesis_grid_loop( array( 'features' => 1, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 0, 'grid_image_size' => 'thumbnail', 'grid_image_class' => 'alignleft', 'grid_content_limit' => 150, 'more' => __( '[Continue reading]', 'genesis' ), ) ); } else { genesis_standard_loop(); } } genesis();
Where should I add it? And I didn´t find a proper hook for this. Any hints?
Thanks
MichaelJuly 3, 2014 at 1:23 am #112796Brad DaltonParticipantBefore the closing genesis(); tag
No need for a conditional tag.
Also, the first part of the code to register the widget goes in your functions file.
July 3, 2014 at 1:58 am #112797michaeloeserMemberHmmm...not quite. When I do this in home.php
<?php remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'eleven40_grid_loop_helper' ); /** Add support for Genesis Grid Loop */ function eleven40_grid_loop_helper() { if ( function_exists( 'genesis_grid_loop' ) ) { genesis_grid_loop( array( 'features' => 1, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 0, 'grid_image_size' => 'thumbnail', 'grid_image_class' => 'alignleft', 'grid_content_limit' => 150, 'more' => __( '[Continue reading]', 'genesis' ), ) ); } else { genesis_standard_loop(); } } function eleven40_after_featured() { genesis_widget_area( 'ad-homepage-only', array( 'before' => '<div class="ad-homepage-only widget-area">', ) ); } genesis();
It displays the widget area before the first (featured) post. I want it right after this post.
Ideas?
July 3, 2014 at 3:01 am #112802Brad DaltonParticipantWheres the add_action for this function eleven40_after_featured() {
You will need to add all the code in your functions file and use a counter to output the widget after the 1st post in the loop
http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive/
July 3, 2014 at 3:25 am #112813michaeloeserMemberAwesome. Works now. But the genesis_after_entry hook seems to be invalid. I used genesis_after_post_content and it works.
Thanks
MichaelJuly 3, 2014 at 5:18 am #112832Brad DaltonParticipantJuly 3, 2014 at 5:37 am #112833michaeloeserMemberStill XHTML on this site
July 3, 2014 at 6:52 am #112843Brad DaltonParticipantThat's why the hook didn't work because its the new HTML 5 loop hook http://my.studiopress.com/docs/genesis-loop-hooks-comparison/
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.