Support » Plugin: WP Show Posts » Possible bug: More than one category name as “article” class

  • Hi,

    I created a list which includes posts from all categories and checked “include terms” under the meta tab.

    I wanted to give a different color to each category name, but I noticed that the “article” html tag has more than one category listed as classes.

    I double checked, and made sure that posts belong to only one category each.

    The first “article” has just a class by it’s own category name – class=”category-categoryname1″, the second has class=”category-categoryname1 category-categoryname2″, the third has class=”category-categoryname1 category-categoryname2 category-categoryname3″, and so on.

    This makes my idea impossible to do, because I need just the actual category name of given “article” as a class to be able to achieve what I want.

    Can something be done about this?

    Cheers!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Branislav

    (@branislav)

    Anyone else notices the same?

    Plugin Author Tom

    (@edge22)

    Hmm, that doesn’t sound right – can you link me to an example page?

    Branislav

    (@branislav)

    Sure, here it is: https://phillipadam.com/blog/

    I have exactly the same problem.

    MikeShand

    (@mikeshand)

    Just to clarify. Here is the article class list for the 4th item in one of my lists:-

    <article class=” wp-show-posts-single wpsp-clearfix post-7478 post type-post status-publish format-standard hentry category-news post-7467 post type-post status-publish format-standard hentry category-song post-7365 post type-post status-publish format-standard hentry category-news post-7288 post type-post status-publish format-standard hentry category-song” itemtype=”http://schema.org/CreativeWork” itemscope>

    Notice that it refers to all 4 posts, i.e. the present item and the 3 previous ones in the list, and includes the post type of each one.

    The 5th item in the list has all 5 etc. etc.

    So as the OP says, there is no way to apply specific CSS to each item in the list, for example to colour them differently if they are category news or song.

    Hope this can be fixed.

    If nothing else, a list of, say, 20 items has a very long class list!

    Plugin Author Tom

    (@edge22)

    Found the issue and merged the fix on GitHub: https://github.com/tomusborne/wp-show-posts/commit/acdfd0aa23ea7b65303c499e3d85306e17116dd7

    Needs some more testing before a release here on WP.org, but feel free to update your files.

    Thanks for reporting!

    MikeShand

    (@mikeshand)

    Thanks. Yes that works perfectly now.

    Plugin Author Tom

    (@edge22)

    Awesome, thanks for letting me know 🙂

    Branislav

    (@branislav)

    I can confirm that the problem is fixed. Thanks Tom.

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.