• Resolved miro83

    (@miro83)


    Hi,
    I need assistance with formatting the HTML output. I managed to load my custom template(copy of default.php). Now, my goal is to add classes of category names to each li element in the list. I’m assuming I need to modify line 65 in the template.

    So, what I what to achieve is to have classes in li elements so I can target that elements and style them individually.

    Thank you for the great plugin.

    • This topic was modified 5 years, 9 months ago by miro83.
    • This topic was modified 5 years, 9 months ago by miro83.
    • This topic was modified 5 years, 9 months ago by miro83.
    • This topic was modified 5 years, 9 months ago by miro83.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    Try this code:

    //Start a List Item for each post:
    $categories = array_map( function( $cat ) { return $cat->slug; }, get_the_category() );
    $lcp_display_output .= "<li class='" . implode( " ", $categories ) . "'>";

    Every li element will get as many classes as the corresponding post has assigned to it.

    Thread Starter miro83

    (@miro83)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post format’ is closed to new replies.