WordPress.org

Ready to get started?Download WordPress

Forums

Widget Logic Help! (4 posts)

  1. twilitegxa
    Member
    Posted 2 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
    Member
    Posted 2 years ago #

    Try using is_page_template() instead:
    http://codex.wordpress.org/Function_Reference/is_page_template

    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

    -greg

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 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
    Member
    Posted 1 year 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

Tags

No tags yet.