Forums

wp_list_bookmarks formatting question (5 posts)

  1. ihatealex
    Member
    Posted 1 year ago #

    Hello,

    I'm using the below wp_list_bookmarks() function to display my links

    <?php wp_list_bookmarks('title_li=&categorize=0&category=2&show_description=1'); ?>

    The current format is:
    LINK_NAME1 Description1
    LINK_NAME2 Description2
    etc..

    I would like to display the link as:
    LINK_NAME1 - Description1
    LINK_NAME2 - Description2
    etc..

    Does anyone know how I can modify the wp_list_bookmarks() function to display the ' - '? I don't want to add ' - ' to the description.

    Thanks.

  2. whooami
    Member
    Posted 1 year ago #

  3. ihatealex
    Member
    Posted 1 year ago #

    whoomai thank you very much for pointing me in the right direction! Strange function. I'm new to php and I kept thinking that the text would need to be enclosed in quotes or something.

    Thanks again.

  4. Otto42
    Moderator
    Posted 1 year ago #

    Well, you can also do it this way if it makes more sense to you:

    <?php
    wp_list_bookmarks(array(
    'title_li'=>'',
    'categorize'=>0,
    'category'=>2,
    'show_description'=>1,
    'between'=>' - ',
    ));
    ?>

    That's the way I prefer to do this sort of thing, since it makes it very obvious what is assigned to what.

  5. ihatealex
    Member
    Posted 1 year ago #

    Otto42.

    The code definitely looks cleaner and much easier to read. Thanks for the tip.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.