Viewing 5 replies - 1 through 5 (of 5 total)
  • WordPress allows us to have multiple sidebars. Simply register another sidebar in the place you want to display your widgets.

    This is kind of old, but it gives you the idea.
    https://maddisondesigns.com/2010/03/how-to-add-multiple-widget-sidebars-to-your-wordpress-blog/

    Have a read over this as well.
    https://codex.www.ads-software.com/Function_Reference/register_sidebar

    Just Google wordpress multiple sidebars. Guarantee you’ll find what you want.

    to add this new widget area below the featured post in the loop, you will need to edit the home page template (index.php ?) of your theme;

    for details, on how to do this on your theme, please contact the theme’s developer for support.

    this forum only supports themes from https://www.ads-software.com/themes/

    Thread Starter bettyjohnson

    (@bettyjohnson)

    Thank you @s3mw that was very helpful. I have added a sidebar, but need a little help still!

    As I mentioned above I need only the widget space beneath the first post on my front page, for an adSense code. However after I added the code in my front page

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar front page') ) : ?>
    <?php endif; ?>

    it gives me a space under each post. This is what the code is on the bottom of my front page:

    <div class="postinfo">
    	<?php include (TEMPLATEPATH . '/includes/postmeta.php'); ?>
    	<span class="readmore"><a href="<?php the_permalink(); ?>">Read more</a></span>
    </div> <!-- end postinfo -->
    
    </div> <!-- end div #post -->

    What code would I have to incl. so my widget shows only under the first post?

    try:

    <?php if( $wp_query->current_post == 0 ) dynamic_sidebar('sidebar front page'); ?>

    $wp_query->current_post is the build-in loop counter starting with 0 zero for the first post.

    Thread Starter bettyjohnson

    (@bettyjohnson)

    Perfect @alchymyth it worked. I appreciate your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add a widget area beneath a post on the front page?’ is closed to new replies.