Support » Fixing WordPress » echo single bookmark

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    moderator

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

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

    or:

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

    to make it a link use this:

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

    http://codex.wordpress.org/Function_Reference/get_bookmark

    @keesiemeijer,

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

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

    Specially when I have a couple of different bookmark categories.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘echo single bookmark’ is closed to new replies.