• Resolved thisismyalias

    (@thisismyalias)


    You have built a great plugin here. It’s logic, for me, is better than the biggest custom sidebar plugin.

    It works perfectly with my theme; however, it doesn’t work with the custom page templates I made. I’m not sure what I’m missing to cause this.

    I understand that this question may be outside of the scope of support you’re willing to offer, but I have to try asking. I’m not sure if “display_ca_sidebar” is something I am supposed to use to get the sidebars to appear on my custom templates (like the sidebars do on all of the theme’s other posts/pages).

    Thank you.

    https://wordpress.org/plugins/content-aware-sidebars/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter thisismyalias

    (@thisismyalias)

    Well, to follow up in case you read this, I see now that display_ca_siebar isn’t a solution to my problem.

    I have a custom template, which does display the Pages sidebar, just like other origional theme pages. However, the sidebars created with this plugin will not display on this custom template. It’s odd that sidebars work on the custom template, but not sidebars created with this plugin.

    I also discovered that the plugin does work with other custom pages – I took an origional theme page template (template-faq.php) and renamed it to create a custom page template. The plugin works on this custom template. This tells me that somehow the custom template that isn’t working has something in it that is messing things up.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    Thanks for your feedback.

    When you are referring to Page Templates, do you then mean the templates you can select in the page editor? Or is it templates that are automatically loaded by your theme?

    Also, did you check that you selected the right Host Sidebar when creating a new sidebar, e.g. Replace: Pages sidebar?

    display_ca_sidebar() is a function you can use if your theme does not have any “original” sidebars, or if you want the content aware sidebars to be displayed in a specific spot in your theme. It will display sidebars with the Manual handle.

    Thread Starter thisismyalias

    (@thisismyalias)

    Hi. Thanks for the response. I have made sure I’m selecting the right Host Sidebar in Replace: Pages.

    The page templates I’m referring to are the ones that can be selected in the page editor. For example, I add a new page and select the custom page template (custom = I made it…my theme comes with templates that are not found in the core of WordPress though). The custom template is called “Departments”. The default sidebar for pages do appear on pages made with this template, but sidebars made with your plugin do not. The exact same sidebars work with every other template page aside from my custom ones.

    I’m not sure what you mean by “templates that are automatically loaded by your theme.”

    Plugin Author Joachim Jensen

    (@intoxstudio)

    Do you have any custom database queries in your custom templates? If yes, you should remember to use wp_reset_postdata(). Read more here: http://codex.wordpress.org/Class_Reference/WP_Query

    What I mean about templates being automatically loaded by your theme, is that some themes/theme frameworks have different ways to load custom templates based on different parameters.

    Thread Starter thisismyalias

    (@thisismyalias)

    The custom template must be using custom database queries. I read the article on wp_reset_postdata() but I didn’t learn yet where it goes.

    That article made me think of trying something. I deleted out the part of the custom template with the new code (that I didn’t write) and the plugin worked as expected. So it does have something to do with the queries.

    The section is:

    <section class="span4 articles-list" style="margin-left:0;">
    <!-- Best Practices  ID = 20-->
        <?php query_posts( array( 'category__and' => array($dept_id,20),
        'posts_per_page' => 5,
        'show_count' => 1 ) );
        $total_posts =$wp_query->found_posts;
        $myposts = $wp_query->post_count; 
    
        if ($myposts > 0) { ?>
            <h3><a href="/portal/?page_id=31?department_id=<?php echo $dept_id; ?>&department_name=<?php echo $deptname; ?>">Best Practices (<?php echo $total_posts; ?>)</a></h3>
            <?php while (have_posts()) : the_post(); ?>
            <ul class="articles">
       	        <li class="article-entry standard"><h4><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h4>
                <span class="article-meta"><?php the_modified_date('F j, Y'); ?> in  <?php the_category(', ') ?> </span>
                <span class="like-count"><?php echo get_total_likes($post->ID); ?></span>
                </li>
            </ul>
    	<?php endwhile;
    	} ?>
    </section>

    Thank you for the direction, I’m a little closer now.

    Plugin Author Joachim Jensen

    (@intoxstudio)

    Yes, that query is altering the global post data. Furthermore, because it uses query_posts(), it also alters the global main query. You can read more about that here: http://codex.wordpress.org/Function_Reference/query_posts

    If you do not want your WordPress installation to think that the page is in fact a list of posts (this is what the query does), insert wp_reset_query(); between the last } and ?>

    Thread Starter thisismyalias

    (@thisismyalias)

    Perfect! Thank you very much!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘display_ca_sidebar ?’ is closed to new replies.