Support » Plugin: Related Posts by Taxonomy » Is the plugin not responsive

  • Resolved tiicaa

    (@tiicaa)


    Is the plugin not responsive? I did not find any configuration and I see that it does not respond in the responsive.

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

    (@keesiemeijer)

    Hi tiicaa

    I assume you’re using post thumbnails to display the related posts. It’s basically the same as a WordPress gallery.
    https://codex.wordpress.org/The_WordPress_Gallery

    Your theme should provide the styles for galleries.
    https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/post-thumbnails

    If WordPress galleries are responsive and this plugin is not can you share a link to a page with related posts.

    Or did you mean something else?

    Yes, this plugin is not responsive. This is regrettable.

    One of the beautiful things with Related Post by Taxonomy is, that it outputs standard valid html with logical css selectors, making it a breeze to style the output to match your theme, including responsiveness.

    Styling WordPress galleries, as RPbT outputs related posts as, is really a job for your theme. So you those are not responsive, you will have to style the output yourself. Luckily its easy.

    Below is a CSS snippet I used, to style the related posts to match the desktop/tablet/mobile breakpoints on one of my sites, this one created with Divi…

    Live sample here: https://sonfor.dk/genbrugsbyggemarked/

    Most of the styling is just to make it pretty – the real work is done in the CSS columns part, taking care of two columns on tablet, and one column on mobile.

    /* RELATED POST BY TAXONOMY INLINE BEGIN 2018-10-02 */
    /* documentation: https://keesiemeijer.wordpress.com/related-posts-by-taxonomy/post-thumbnails/ */
    
    /* add some padding on top and set background color */
    .rpbt_shortcode {
    	background: #eeeeee;
    	padding-top: 60px;
    	padding-bottom:20px;
    }
    
    /* align "related posts" title to theme page width */
    .rpbt_shortcode h3 {
    	max-width: 1280px;
    	margin: auto;
    	padding-bottom: 20px;
    }
    
    /* create a centeret 4 column gallery fitted to theme page width */
    .related-gallery {
    	max-width: 1280px;
    	margin: auto;
    	column-count: 4;
    	column-gap: 40px;
    }
    
    /* reduced width on lower res displays */
    @media all and (max-width: 1405px) {
    	.rpbt_shortcode h3,
    	.related-gallery {
    		max-width: 90%;
    	}
    }
    
    /*** two columns on even lower res displays ***/
    @media all and (max-width: 1100px) {
    	.related-gallery {
    		column-count: 2;
    	}
    }
    
    /*** one column on phones ***/
    @media all and (max-width: 767px) {
    	.related-gallery {
    		column-count: 1;
    	}
    }
    
    /* white background full width gallery item container */
    .related-gallery .gallery-item a,
    .gallery-caption {
        background:#ffffff;
        width: 100%;
    }
    
    /* full column width image please */
    .related-gallery .gallery-item img {
    	width: 100%;
    } 
    
    /* subtle image hover effect */
    .related-gallery .gallery-item img:hover {
    	filter: opacity(0.8);
    	transition: 0.3s;
    }
    
    /* whitespace around image caption (post title) */
    .related-gallery .gallery-caption {
    	padding: 10px 15px 15px;
    }
    
    /* image caption color */
    .related-gallery .gallery-caption a {
    	color: #424242;
    }
    
    /* image caption hover underline */
    .related-gallery .gallery-caption a:hover {
    	text-decoration: underline
    }
    
    /* cancel default left margin */
    .related-gallery dd {
    	margin-left: 0;
    }
    
    /* box shadow around gallery item */
    .related-gallery .gallery-item {
    	box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.3);
    }
    
    /* css columns don't render well in older browsers (IE), so hide it all together  */
    @media all and (-ms-high-contrast: none),
    (-ms-high-contrast: active) {
    	.rpbt_shortcode {
    		display: none;
    	}
    }
    
    /* RELATED POST BY TAXONOMY INLINE END */

    I don’t want to use the default WordPress styling of galleries, and that can easily be disabled with a little functions.php snippet:

    
    // Be aware this removes the inline style for all galleries.
      
    // You'll have to add your own gallery styles in your (child) theme's stylesheet.
    add_filter( 'use_default_gallery_style', '__return_false' );
    

    Finally, I chose to add the RPbT shortcode, to all my Divi posts automatically, with this functions.php snippet:

    function before_divi_footer() {
        //check if it's a single post page.
        if ( is_single() ) {
     			echo do_shortcode('[related_posts_by_tax columns="4" format="thumbnails" image_size="medium" posts_per_page="4" link_caption="true" title="Læs også om …"]');
     	}
    }
    add_action('et_after_main_content', 'before_divi_footer');
    

    Hope that might be an inspirational to you. RPbT is incredibly versatile, outputs valid code and can be styled to match you need.

    /Bjarne

    @oldrup Thank you for this! It gave a great starting to integrate with Divi. Thanks for fast tracking us with this foundation 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is the plugin not responsive’ is closed to new replies.