Forums

[resolved] Selecting which link category to display on a page (5 posts)

  1. farinha
    Member
    Posted 3 years ago #

    Hello!

    I want to display all the links in a certain link category in one page, and not any of the other links.

    And in the remaining pages I want to display every link except those that have said category.

    I can think of a dumb way of doing it, using a simple "Text Widget" and doing the list in HTML, but I was wondering if there was a smarter way. Like a way of being able to select which link categories I want displayed on a "Links" widget. A way to have several such widgets would also be great.

    Thanks in advance.

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Links get displayed, typically, with the template tag, wp_list_bookmarks(), there is the exclude_category= to exclude categories, and the category= parameter to include categories.

    .

  3. farinha
    Member
    Posted 3 years ago #

    So that means I won't be able to use the provided "Links" widget and I'll have to use a few "Text" widgets and using those functions to display what I want?

  4. MichaelH
    Volunteer
    Posted 3 years ago #

    Consider downloading and installing Otto's php code widget.

    Then put the correct wp_list_bookmarks code in each of the widgets you need.

    Please remember to support our plugin authors by clicking on the Donate button there.

    Example of possible code for widget:

    <?php wp_list_bookmarks('exclude_category=2'); ?>
  5. farinha
    Member
    Posted 3 years ago #

    That should work. Thanks for all the help.

Topic Closed

This topic has been closed to new replies.

About this Topic