• In Bushwick, at the bottom of a post, the categories & tags which are linked to the post are displayed. Currently, they are shown as a definition list (DL). What’s more, the tags and categories lists are both nested within a single DL-tag.

    What I would like to do is 1 of 2 things. I would like to either output both lists as separate ULs. Or I would like to output both lists, but put each list (either the categories, or the tags) in a separate DL.
    Both options will make it much easier for me to style the tags and categories lists in the way I want to. Among others, it will make it easier for me to display the tags & cats horizontally (or side-by-side) instead of the current vertical layout (which is the default for a DL).
    However, I cannot find out how to do/change this.

    I looked at “content-single.php”, as this is where the 2 lists seem to be generated.
    I changed both calls for the cats & tags to calls without parameters. According to the WordPress reference, this should result in 2 ULs being output. Which is sort of what happens, but these lists are still nested in DL and DD tags. Which is not what I want!
    I CAN of course add PHP code to strip the DL-formatting from the output and then add the tags that I want. But that to me seems like a very ‘dirty’ way of getting to what I want: I cannot imagine that there is not an easier or cleaner way to do this…!

Viewing 1 replies (of 1 total)
  • Hi there!

    I looked at “content-single.php”, as this is where the 2 lists seem to be generated.
    I changed both calls for the cats & tags to calls without parameters.

    Just a heads-up that the best way to make changes to a theme is to use a child theme. If you edit the theme files directly as you’ve done, your tweaks will be overwritten and lost every time you update the theme. Here are some guides in case you haven’t made one before:

    http://codex.wordpress.org/Child_Themes
    https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/
    http://vimeo.com/39023468

    Keeping your theme up-to-date is important so you’ll get all the latest bug and security fixes, as well as keep the theme compatible with the latest version of WordPress core.

    Your categories and tags, while still in a dl, seem to be displayed horizontally on your site at the moment. Are you still looking to tweak anything more about the display?

    I used this basic code — both examples taken from the Codex — in a Bushwick test child theme and it output uls with categories and tags:

    echo get_the_category_list(); 
    
    if(get_the_tag_list()) {
      echo get_the_tag_list('<ul><li>','</li><li>','</li></ul>');
    }

    Screenshot: https://cloudup.com/cQk7z1nQzrm

    Let me know how it goes.

Viewing 1 replies (of 1 total)
  • The topic ‘How to modify the tags & categories styling’ is closed to new replies.