Forums

Displaying a post's tags and catagories as list items (4 posts)

  1. Mercer2789
    Member
    Posted 2 years ago #

    I'm developing a custom theme based off of other themes I've liked and for the most part things are going pretty well. I have no formal training in SQL or PHP so please forgive any errors in how I word this.

    The problem I'm having is finding a function code to display a list of each individual post's categories and tags, as a list items. Meaning I'd like to have a ul tag before the list (which I could just html in) and then a li and /li tag after each category and tag. Seems simple enough but I can't figure this out.

    I've tried using scripts used for displaying list items I've found in function codes for sidebars(placing the ul and li html tags before the list and between each list item) Nothing has worked for me so far.

    If anyone knows how to write the script/code for a themes function code page, and also what script to use to pull up the lists in each individual post please help me out. I wouldn't ask in here if I hadn't tried several different methods.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Do you mean something like:

    <ul>
    <li>Filed under: <ul><li><?php the_category(',</li> <li>') ?></li></ul></li>
    <?php if(get_the_tag_list()) :?>
    <li>Tags: <?php the_tags('<ul><li>',',</li> <li>','</li></ul>');?></li>
    <?php endif;?>
    </ul>
  3. Mercer2789
    Member
    Posted 2 years ago #

    I'll give that a try right now and thank you, very appreciated.

  4. Mercer2789
    Member
    Posted 2 years ago #

    Worked like a charm, thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Topic