• Hello Everyone,

    I am wondering how I can make something like this when I am posting a message: https://www.andrewgreig.com/

    You see every category has a dofferent color, images, article, video, snippet etc. Its like Tumblr, also woothemes is using this technique in some of their latest themes.

    What plug0in or code I need to use to get this result? Anyone has some article about this issue?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kplop

    (@kplop)

    still didnt find any article, plugin or whatsoever which makes this style… ??

    it looks like this site outputs the name of the category into the post html element; and then uses it to style the post.

    they are using list elements to show the post, but similar would work with divs:

    <li class="post <?php $categories = wp_get_post_categories(get_the_ID()); echo get_category($categories[0])->slug; ?>" id="post-<?php the_ID(); ?>">

    this outputs the slug of the first category of the post as an additional css class.

    assuming the category would be ‘Video Show’, the style for it could be
    .post.video-show { ... }

    Thread Starter kplop

    (@kplop)

    thanks! i just wike up and i was thinking exactly the same and the thoughts seems to be confirmed:) and with this peace of code i can put more tags to it and use the first one as the category.

    thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘show post in different colors’ is closed to new replies.