[resolved] wp_list_bookmarks fails if argument is $varname (4 posts)

  1. BeingMaverick
    Posted 5 years ago #

    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");

  2. Michael
    Forum Moderator
    Posted 5 years ago #

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





  3. BeingMaverick
    Posted 5 years ago #

    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..

  4. BeingMaverick
    Posted 5 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic