• Resolved kissedvixen

    (@kissedvixen)


    Hello again.

    This plugin is great and working the way I had hoped, cross linking posts and products! yay

    I was just wondering if there was a way.. so that when people look at the sidebar and see the related that they can tell if it is a product in our store or a post.

    I figured either a different background color around the thumbnail for products.

    Or maybe a highlight behind the title – say blue highlight for products and white for posts.

    Something that will have people easily identify what they will be clicking on 🙂

    Thanks!

    https://wordpress.org/plugins/related-posts-by-taxonomy/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    Hi kissedvixen

    I’ve created a beta version with a new filter just for this. Download the Development Version here:
    https://wordpress.org/plugins/related-posts-by-taxonomy/developers/

    Example to add the post type class to the gallery items:

    add_filter( 'related_posts_by_taxonomy_gallery_item_class', 'rpbt_gallery_item_class', 10, 3 );
    
    function rpbt_gallery_item_class(  $class, $related, $args ) {
    	$post_type_class = isset( $related->post_type ) ? ' rpbt_' . sanitize_html_class( $related->post_type ) : '';
    
    	return $class . $post_type_class;
    }

    Now you can style the thumbnails like this:

    .related-gallery .rpbt_post {
        /* css rules here */
    }
    
    .related-gallery .rpbt_product {
        /* css rules here */
    }

    See https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/post-thumbnails/#styling

    Thread Starter kissedvixen

    (@kissedvixen)

    Ah you are amazing! This worked great!!

    At first I thought I just had to update the plugin with the beta. Then add the css…that didn’t do anything.

    But when I added the filter to my child theme function.php then it worked great!
    I was able to not only add different background colors, but padding and make the thumbnails center better!!

    Thank you 🙂

    Plugin Author keesiemeijer

    (@keesiemeijer)

    No problem. It was a good idea for a future release.
    I’m glad you’ve got it resolved 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show differences between related products and posts – say with background color?’ is closed to new replies.