echo single bookmark (4 posts)

  1. awildthingy
    Posted 4 years ago #

    Hey all, I'm going crazy, all I want to do is echo out a single bookmark in my footer. The Codex would have me believe that the best way to go is get_bookmark() but I have been banging my head on the wall for an 2 hours trying to figure out the proper syntax as the documentation is shall we say "lacking". there are no examples that I can find and I don't really even know what kind of value to pass it.

    variations I have tried:

    <?php echo get_bookmark( 1 ); ?>
    <?php echo get_bookmark( '1' ); ?>
    <?php echo get_bookmark( link_id=1 ); ?>
    <?php echo get_bookmark( 'link_id=1' ); ?>
    <?php echo get_bookmark( id=1 ); ?>
    <?php echo get_bookmark( 'id=1' ); ?>

    If anyone could share I would highly appreciate it. I'll personally see to updating the codex page with whatever I find because it seriously shouldn't be so difficult to find out.

  2. keesiemeijer
    Posted 4 years ago #

    It returns an object. This is the correct way to call it:

    $bookmark = get_bookmark( 1 );
    echo $bookmark->link_name;


    <?php echo get_bookmark( 1 )->link_name; ?>

    to make it a link use this:

    $bookmark = get_bookmark( 1 );
    echo '<a href="'.$bookmark->link_url.'">'.$bookmark->link_name.'</a>';


  3. awildthingy
    Posted 4 years ago #


    Thank you VERY much! See, this example needs to be on the Function Reference page for all to find easily. Works perfectly; Thanks again.

  4. harrymfa
    Posted 4 years ago #

    Does anybody know how to find the single bookmark number?
    get_bookmark( $singlebookmark );

    Specially when I have a couple of different bookmark categories.

Topic Closed

This topic has been closed to new replies.

About this Topic