Skip to content

Instantly share code, notes, and snippets.

@dannydover
Last active November 19, 2018 18:18
Show Gist options
  • Select an option

  • Save dannydover/76e8bd1c31ca011de2bcdb412a555ce7 to your computer and use it in GitHub Desktop.

Select an option

Save dannydover/76e8bd1c31ca011de2bcdb412a555ce7 to your computer and use it in GitHub Desktop.

Revisions

  1. dannydover revised this gist Nov 19, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functions.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    function featuredtoRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
    $content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
    $content = '<div>' . get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
    }
    return $content;
    }
  2. dannydover revised this gist Nov 19, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    <?php

    /* Add Featured Image to beginning of RSS Feed entries */
    function featuredtoRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
  3. dannydover created this gist Nov 19, 2018.
    14 changes: 14 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php

    function featuredtoRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
    $content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
    }
    return $content;
    }

    add_filter('the_excerpt_rss', 'featuredtoRSS');
    add_filter('the_content_feed', 'featuredtoRSS');

    ?>