WordPress.org

Forums

Custom Template Breaks Widget Visibility (6 posts)

  1. gsparrowpepin
    Member
    Posted 1 year ago #

    I love the new jetpack widget visibility however for some reason it won't display widgets only on the front page. If I do not select anything for visibility it will display on all pages including the front page. However if I tell it to appear on the front page it will not.

    I think it has something to do with the fact that I am using a custom template for my static front page. If I use the default template it works and shows up on the front page. When I switch it to my custom template it doesn't.

    I don't know why because if I am not trying to restrict a widgets visibility it will show up on the front page with my template! Help?

  2. Allen Moore
    Member
    Posted 1 year ago #

    Hey gsparrowpepin,

    In regards to the custom template that you are using for your static front page, are you calling the widget function?

  3. gsparrowpepin
    Member
    Posted 1 year ago #

    Hmm, I don't know that I am. I am calling the get_sidebar() function but no function to do with widgets. What one should I be using?

  4. gsparrowpepin
    Member
    Posted 1 year ago #

    So, I've been narrowing things down and it seems to be because of the way I am trying to get posts on the template. (I want it to be a static page, with recent posts below it). Here is the code that breaks it. Any ideas?

    <div id="hompageNewsContainer">
    		<h2 class="homenewsHeader">News</h2>
    		<?php query_posts( 'category_name=news'); ?>
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<a name="<?php the_title(); ?>" href="<?php the_permalink() ?>"><h1 class="entry-title home-post-title"><?php the_title(); ?></h1></a>
    			<?php the_post_thumbnail('home-post-thumbnail') ?>
    			<?php the_excerpt(); ?>
    			<?php comments_template('', true); ?>
    		</div>
    
    		<?php endwhile; endif; ?>
    	</div>
  5. gsparrowpepin
    Member
    Posted 1 year ago #

    Ok, thanks for the response. I have figured it out. Ill post so if anyone has this issue they might find the answer more quickly. I was not using <?php wp_reset_query(); ?> after my query. And this broke the sidebar query.

  6. Allen Moore
    Member
    Posted 1 year ago #

    Hey gsparrowpepin,

    Sorry for my late reply! Great job on resolving the issue!

    Here is some additional info on wp_reset_query for the future: http://www.poststat.us/properly-reset-wordpress-query/

Topic Closed

This topic has been closed to new replies.

About this Topic