Forums

wp_list_bookmarks and is_home problem.. (6 posts)

  1. yabate
    Member
    Posted 1 year ago #

    Hello..

    I want to make my links visible only on home page.I have two link categories (Links and Friends), but for now i'm using only second(friends).
    Do i need to remove links widget or to leave it on a sidebar?I tried both, and nothing..

    I use this code

    <?php if(is_home() && !is_paged()) : ?>
    <?php wp_reset_query(); ?>
    <?php wp_list_bookmarks('categorize=0'); ?>
    <?php endif  ?>

    Is this OK?
    How to make it working?

    Thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Try:

    <?php
    if(is_home() && !is_paged()) :
    wp_list_bookmarks('categorize=0');
    endif  ?>
  3. yabate
    Member
    Posted 1 year ago #

    Thanks for the code, but i couldn't make it work.

  4. Tamara.Urry
    Member
    Posted 1 year ago #

    The point of wp_reset_query() is to requery the current page. WPress only allows for one is_home() or is_front_page() type of query per rendering.

    If it isn't working that means the query is being used somewhere else when the page is being built.

    Place wp_reset_query() above the if statement and you'll be fine.

    <?php wp_reset_query(); ?>
    
    <?php if(is_home() && !is_paged()) : ?>
    <?php wp_list_bookmarks('categorize=0'); ?>
    <?php endif  ?>
  5. Tamara.Urry
    Member
    Posted 1 year ago #

    This syntax works.

    <?php
            wp_reset_query();
    	if (is_front_page()) {?>
    	<?php wp_list_bookmarks('categorize=0'); ?>
    <?php }?>
  6. yabate
    Member
    Posted 1 year ago #

    Thanks Tamara :)
    Thank you very much.
    Its working now... finally :) :)

Topic Closed

This topic has been closed to new replies.

About this Topic