Support » Plugin: Contextual Related Posts » Custom HTML and CSS in feeds

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


    By default, the plugin outputs the same HTML in the feed as it does for the normal sites.

    But, I’m not really sure how you can customise the CSS of related posts in feeds.

    Thread Starter Milos Spasic


    CSS can be embedded direct into the HTML.

    Short example:

    <div class="crp_related" style="clear:left; padding:15px 0 0 0;">
    	<h3 style="padding:0 0 10px 0;">

    And by using ‘is_feed’ conditional tag →, that custom CSS can be displayed only on feed page.

    Plugin Author Ajay


    The issue with this approach is that you’re essentially overwriting the HTML that the plugin generates.

    If you’re really keen on CSS with the HTML feed, then the best approach would be to write your own function in your functions.php to add the related posts to the feed.

    In the plugin, you have the function ald_crp_rss that does this for you.

    Alternatively you might want to take a look at which is a rather old plugin that helps style feeds

    Thread Starter Milos Spasic


    Thank you for the replay.

    At the end, I came up with this solution:

    1) Under the plugin settings find “Add related posts to:” and turn off “Feeds“.

    2) Add this to the end of your theme functions.php file:

    /* Add related posts to feeds */
    function ald_crp_rss_custom($content) {
    global $post;
    global $crp_settings;
    $limit_feed = $crp_settings['limit_feed'];
    $show_excerpt_feed = $crp_settings['show_excerpt_feed'];
    $post_thumb_op_feed = $crp_settings['post_thumb_op_feed'];
    if(function_exists('ald_crp')) {
    	return $content. '<div style="clear:left; padding:15px 0 0 0;">' .ald_crp('is_widget=0&limit='.$limit_feed.'&show_excerpt='.$show_excerpt_feed.'&post_thumb_op='.$post_thumb_op_feed). '</div>';
    	else { return $content; }
    add_filter('the_excerpt_rss', 'ald_crp_rss_custom');
    add_filter('the_content_feed', 'ald_crp_rss_custom');

    I hope this would help someone.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom HTML and CSS in feeds’ is closed to new replies.