WordPress.org

Ready to get started?Download WordPress

Forums

is_home() is_front_page() not working in sidebar.php (3 posts)

  1. blk784
    Member
    Posted 2 years ago #

    Im trying to add a custom sidebar item in my sidebar.php only on the homepage but cant get the is_home() and is_front_page() functions to work.

    Any ideas??????

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    does the main column contain any custom query without proper resetting?

    try to add wp_reset_query(); before the call of the sidebar.

    http://codex.wordpress.org/Function_Reference/wp_reset_query

  3. blk784
    Member
    Posted 2 years ago #

    I have used add_filter to customize the query in the functions.php within the theme folder. This gives me the custom query but I can't seem to get functions like, remove_filter or wp_reset_query to work in the index.php. Also, I have tried wrapping the add_filter function with if(is_home) or if(is_front_page) so that only this custom query is used on the front page but it fails to give me the results I want as well. Where could I place this code so that it only applies my filter on the homepage?

Topic Closed

This topic has been closed to new replies.

About this Topic