Support » Fixing WordPress » Sidebar Widgets not Showing on page with Same Template

  • Hi there, I have an issue that is driving me crazy.

    I have a “default” page template that shows the sidebar and sidebar widgets. You can see it in action here: http://www.singlesrc.com/webinars/

    However, I just created a new page, with the same template and identical setup, but the widgets aren’t showing up – just the grey box that is the sidebar div, but without the widgets in it. http://www.singlesrc.com/about/

    I have also tested created additional new pages with the “default” template, and the sidebar widgets don’t show up there, either.

    I have checked through every setting and can’t find a reason why the sidebar would show up on the one page but not the other. I tried tinkering with the plugin “Display Widgets,” checking and unchecking which pages the two widgets would appear on. I was able to hide them from the Webinars page, but never able to make them appear on the About page. Now I have deactivated the plugin.

    I’ve also tried clearing my browser cache.

    Anyone know what is going on? I would greatly appreciate some help figuring this out. Thank you in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • What template do you used?
    Can you post the content of the template? I mean the php file that you use as template?

    Sure, it’s:

    <?php get_header(); ?>

    <?php the_post(); ?>

    <div class=”content full”>
    <div class=”wrap group”>

    <div class=”post” id=”post-<?php the_ID(); ?>” style=”float: left; width: 60%;”>
    <h1><?php the_title(); ?></h1>
    <div class=”entry”>
    <?php the_content(); ?>
    </div>
    </div>
    <?php get_sidebar(); ?>
    </div>
    </div>
    <?php get_footer(); ?>

    And the .php of the sidebar itself is:

    <div class=”sidebar”>
    <?php if(get_field(“show_donut_chart”) == “Yes”): ?>
    <?php the_field(“chart_code”, “option”); ?>
    <script type=”text/javascript”>
    var _class;

    $(“.chart a”).hover(function(){
    $(“.chart img”).hide();

    _class = $(this).attr(“class”);
    $(“p.” + _class).show();
    }, function(){
    $(“.chart p”).hide();
    $(“.chart img”).show();
    });
    </script>
    <?php endif; ?>

    <?php if (function_exists(‘dynamic_sidebar’) && get_field(“show_sidebar_widgets”) == “Yes”): ?>
    <?php dynamic_sidebar(‘Sidebar Widgets’); ?>
    <?php endif; ?>

    <?php if(!is_page_template(‘archive.php’) && get_field(“show_latest_news”) == “Yes”): ?>
    <div class=”latest-news”>
    <!– <h3>Latest News & Information</h3>

      <?php $args = array(
      ‘post_type’ => ‘post’,
      ‘post_count’ => 3,
      );
      $featured_posts = get_posts( $args );

      foreach($featured_posts as $i => $post):
      setup_postdata($post); ?>

    • <h4><?php the_title(); ?></h4>
      <?php the_excerpt(); ?>
    • <?php endforeach; wp_reset_query(); ?>

    –>
    <h5>“>Read More News | “>Subscribe to News Feed</h5>
    </div>
    <?php endif; ?>
    </div>

    Michael

    (@alchymyth)

    Forum Moderator

    the code in sidebar.php is asking for:

    <?php if (function_exists('dynamic_sidebar') && get_field("show_sidebar_widgets") == “Yes”): ?>
    

    is the 'field' ‘show_sidebar_widgets’ set in all of those pages?

    also, please read https://codex.wordpress.org/Forum_Welcome#Posting_Code for corectly posting code here in the forum.

    Thank you for the tip.

    That worked! I added in the custom field show_sidebar_widgets = Yes for the About page, and the widgets showed up! Thank you!!! The strange thing is that that field is not defined for the Webinars page, where the widgets have been showing without fail. Weird.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sidebar Widgets not Showing on page with Same Template’ is closed to new replies.