WordPress.org

Ready to get started?Download WordPress

Forums

using wp_list_bookmarks on single.php pages (3 posts)

  1. kayjayone
    Member
    Posted 5 years ago #

    I've implemented custom single.php pages (single-10.php for example) and I'm trying to pull links based on the same category using the following...

    <?php wp_list_bookmarks('categorize=0&category=10&title_li'); ?>

    While this works on other pages it does not on the custom single pages, no links are displayed. Does the wp_list_bookmarks work on single.php pages?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Obvious question: Are there any links in category 10?

    And yes, wp_list_bookmarks can be used anywhere in the theme.

    Also, "single-10"? How are you referencing/loading this file? WordPress does not load/use single-anything. Just "single.php".

  3. kayjayone
    Member
    Posted 5 years ago #

    Hi Otto42

    There are links in category 10 and they are displaying correctly on another page.

    Calling single-10.php from single.php using the following code...

    <?php
    $category = get_the_category();
    $currentcat = $category[0]->cat_ID;
    if (file_exists(TEMPLATEPATH."/single-$currentcat".".php")) {
    include(TEMPLATEPATH."/single-$currentcat".".php");
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic