Quantcast
Channel: Active questions tagged feed - Stack Overflow
Viewing all articles
Browse latest Browse all 539

feed rss from link show image thumbnail for wordpress site (never solved)

$
0
0

the question has never been solved for some time, I changed the theme but I never managed to solve.I created some pages in wordpress, with a basic GridHub theme, I added an rss widget to the page, I can insert the .xml link with the news, but the images are not shown, only the news without image, I checked the feed link on feeds. msn .com/evaluation and the images are present in the original feed. never solved

this is functions.php i tried to modify

<?php/*** GridHub functions and definitions.** @link https://developer.wordpress.org/themes/basics/theme-functions/** @package GridHub WordPress Theme* @copyright Copyright (C) 2020 ThemesDNA* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later* @author ThemesDNA <themesdna@gmail.com>*/define( 'GRIDHUB_PROURL', '' );define( 'GRIDHUB_CONTACTURL', '' );define( 'GRIDHUB_THEMEOPTIONSDIR', get_template_directory() . '/inc' );// Add new constant that returns true if WooCommerce is activedefine( 'GRIDHUB_WOOCOMMERCE_ACTIVE', class_exists( 'WooCommerce' ) );require_once( GRIDHUB_THEMEOPTIONSDIR . '/customizer.php' );/** * This function return a value of given theme option name from database. * * @since 1.0.0 * * @param string $option Theme option to return. * @return mixed The value of theme option. *///*rss code aggiunto per imagefunction get_my_first_image() {    global $post, $posts;    $my_first_img = '';    if (strpos($post->post_content, '<img') != false) {        preg_match('/http:\/\/[^"]+(gif|jpg|jpeg|png)/Ui', $post->post_content, $matches_ima) ;         $my_first_img=$matches_ima[0];    }    return $my_first_img;}//*first rss code try function featuredtoRSS($content) {global $post;if ( has_post_thumbnail( $post->ID ) ){$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 5px;' ) ) . '</div>' . $content;}return $content;}add_filter('the_excerpt_rss', 'featuredtoRSS');add_filter('the_content_feed', 'featuredtoRSS');//*stop first rss code//* THIS ADD RSS USE IMAGE   add_action('widgets_init' , 'awpg_widgets_init' );    function rss_post_thumbnail($content) {global $post;if(has_post_thumbnail($post->ID)) {$content = '<p>' . get_the_post_thumbnail($post->ID) .'</p>' . get_the_content();}return $content;}add_filter('the_excerpt_rss', 'rss_post_thumbnail');add_filter('the_content_feed', 'rss_post_thumbnail');//*stop rssfunction gridhub_get_option($option) {    $gridhub_options = get_option('gridhub_options');    if ((is_array($gridhub_options)) && (array_key_exists($option, $gridhub_options))) {        return $gridhub_options[$option];    }    else {        return '';    }}if ( ! function_exists( 'gridhub_setup' ) ) :/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */function gridhub_setup() {    global $wp_version;    /*     * Make theme available for translation.     * Translations can be filed in the /languages/ directory.     * If you're building a theme based on GridHub, use a find and replace     * to change 'gridhub' to the name of your theme in all the template files.     */    load_theme_textdomain( 'gridhub', get_template_directory() . '/languages' );    // Add default posts and comments RSS feed links to head.    add_theme_support( 'automatic-feed-links' );    /*     * Let WordPress manage the document title.     * By adding theme support, we declare that this theme does not use a     * hard-coded <title> tag in the document head, and expect WordPress to     * provide it for us.     */    add_theme_support( 'title-tag' );    /*     * Enable support for Post Thumbnails on posts and pages.     *     * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails     */    add_theme_support( 'post-thumbnails' );    if ( function_exists( 'add_image_size' ) ) {        add_image_size( 'gridhub-1292w-autoh-image', 1292, 9999, false );        add_image_size( 'gridhub-936w-autoh-image', 936, 9999, false );        add_image_size( 'gridhub-480w-360h-image', 480, 360, true );    }    // This theme uses wp_nav_menu() in one location.    register_nav_menus( array('primary' => esc_html__('Primary Menu', 'gridhub'),'secondary' => esc_html__('Secondary Menu', 'gridhub')    ) );    /*     * Switch default core markup for search form, comment form, and comments     * to output valid HTML5.     */    $markup = array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' );    add_theme_support( 'html5', $markup );    add_theme_support( 'custom-logo', array('height'      => 37,'width'       => 280,'flex-height' => true,'flex-width'  => true,'header-text' => array( 'site-title', 'site-description' ),    ) );    // Support for Custom Header    add_theme_support( 'custom-header', apply_filters( 'gridhub_custom_header_args', array('default-image'          => '','default-text-color'     => 'ffffff','width'                  => 1920,'height'                 => 400,'flex-width'            => true,'flex-height'            => true,'wp-head-callback'       => 'gridhub_header_style','uploads'                => true,    ) ) );    // Set up the WordPress core custom background feature.    $background_args = array('default-color'          => 'e6e6e6','default-image'          => get_template_directory_uri() .'/assets/images/background.jpg','default-repeat'         => 'repeat','default-position-x'     => 'left','default-position-y'     => 'top','default-size'     => 'auto','default-attachment'     => 'fixed','wp-head-callback'       => '_custom_background_cb','admin-head-callback'    => 'admin_head_callback_func','admin-preview-callback' => 'admin_preview_callback_func',    );    add_theme_support( 'custom-background', apply_filters( 'gridhub_custom_background_args', $background_args) );    // Support for Custom Editor Style    add_editor_style( 'css/editor-style.css' );}endif;add_action( 'after_setup_theme', 'gridhub_setup' );require_once( trailingslashit( get_template_directory() ) . 'inc/init.php' );require_once( trailingslashit( get_template_directory() ) . 'inc/custom.php' );

Viewing all articles
Browse latest Browse all 539

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>