Widget Logic Help! (4 posts)

  1. twilitegxa
    Posted 4 years ago #

    I'm trying to use Widget Logic and I'm trying to display my widget for recent posts only on the page named Blog, which is supposed to be iD 38, but when I try is_page('38'), is_page(38), is_page('blog'), or is_page(blog), none of them work. What am I doing wrong? Here is my site's URL: http://igsportspicks.com/blog/

  2. datdesignguy
    Posted 4 years ago #

    Try using is_page_template() instead:

    just pass the function the name of your blog page template... I beleive its either called blog.php or page-template-blog.php according to your sites body class tags.

    so if the template is "blog.php"

    use: if ( is_page_template( 'blog.php' ) ) { }

    I hope this helps


  3. Michael
    Forum Moderator
    Posted 4 years ago #

    it is possible that the information of the page id got disturbed by the code within the template - not all codes are careful to keep the original query_string and/or $post object intact.

    try to add wp_reset_query(); or wp_reset_postdata(); after the custom loop in the template.

  4. kwestalot
    Posted 3 years ago #

    I know this is a ridiculously old article, but it might be what I need.

    I'm trying to call my blog.php template, but it's not working.

    Where would I add the wp_reset_query(); or wp_reset_postdata(); ??

    I don't really understand what the custom loop in the template means...

    For the full backstory to my problem, here's my post: http://wordpress.org/support/topic/blogphp-template-how-to-call-for-ifelse-statement?replies=9

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.