Support » Themes and Templates » wp_list_bookmarks fails if argument is $varname

  • Resolved BeingMaverick


    I am writing a very simple code to list links based on category passed read from meta data of a post. If I hard code the category in the wp_list_bookmarks funct, it works fine but when i pass as a variable, it fails and shows a blank screen. below is the piece of code.

    $category = get_post_meta($posts[0]->ID, ‘Category’, true);
    $album = get_post_meta($posts[0]->ID,’Album’,true);
    echo ($category);
    echo ($album);
    if ($category == “MusicAlbum”)
    echo (“inside if”);

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael


    Forum Moderator

    you could try and tidy this line (excess amperand & at the end) and see if that helps:






    Thanks for your reply..I had tried both the above option and they dont work. The weird part is, it goes inside the if condition and outputs “inside if”, also the value of $album is displayed by echo statement, but wp_list_bookmarks does not work.

    Below is the output
    MusicAlbum3-Idiotsinside if

    If I replace $album with 3-Idiots, it works fine. So its definitely to do with $album. Does it require any escape character to understand the $ sign?? Or is it something to do with the theme(Arjuna X 1.3.8) I am using?

    Your reply is much appreciated..

    alchymyth the problem is resolved.
    I was being stupid by adding extra ‘ in wp_list_bookmarks


    The correct format should have been,

    Thanks for your help and support, much appreciated.

    Just out of curiosity, what if we have 2 variables as arguments? how will that work?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_list_bookmarks fails if argument is $varname’ is closed to new replies.