WordPress.org

Ready to get started?Download WordPress

Forums

WP Simple Rss Feed Reader
Font Style (5 posts)

  1. dukejames27
    Member
    Posted 2 years ago #

    The font style coming from the title of the RSS feed does not match the styles used on my other widgets. I was under the impression that the style was coming from my style.css file but it looks like maybe this plugin is overriding it?

    I can't find anywhere in the code which refers to html font tags or a css style. Does anyone know how to configure or remove the font styling from the feed?

    Thanks.

    http://wordpress.org/extend/plugins/wp-simple-rss-feed-reader/

  2. carlacoon
    Member
    Posted 2 years ago #

    Ditto - I think, not to hijack your ? but help is hard to come by so maybe someone can help both of us. When I first made my blog, I got the rss widget and the link is in the right sidebar under Meta "Entries RSS" and when I clicked on it, it brought me to my feed url page: http://carlacoon.com/blog/?feed=rss2
    At the top was a thing asj=king if i wanted to subscribe. My blog post showed below with the picture I'd posted and the nice font etc. It looked just like my blog. After successfully installing a child theme, when I checked the RSS url, the type had changed to tiny Times New Roman and the picture was on the left by itself with text below, not how like my blog and kinda ugly. How can I change it back? I want my feed to have same font and properties as my blog but hav eno idea where to change the properties.
    Thanks for any help. Sorry about the intrusion, Duke.
    http://carlacoon.com/blog

  3. viancen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi there,

    The plugin does not do anything with styles, it also inherits the default before and after widget html. What does happen is it gives the output classes which refer to the plugin (so other people can style it).

    It uses an ul > li structure to parse the feed you enter, so maybe with some simple styling in your theme you can make it look pretty again?

    the ul has class 'wp-simple-rss-list' and it contains a H3 in every li.

  4. owlana
    Member
    Posted 1 year ago #

    hey all.

    i had the same problem, so i went right into the php and fiddled with the styling there.

    here's the barebones, no style, no big spaces, no H3 shenanigans code.

    paste this into yer wp-simple-rss-feed-reader.php over the over original code. this might help?

    - owlana

    <?php
    /*
    Plugin Name: WP Simple Rss Feed Reader
    Description: Plugin to view an rss feed on your page or post. [simple-rss feed="http://www.yourfeed.com/myfeed.xml" limit=10]. Simply use the shortcode and the RSS feed will be shown in HTML to your visitor
    Version: 0.6.3
    Author: Viancen
    Author URI: http://viancen.com
    License: GPL2
    */
    
        function SimplRssfirstWords($string,$words=100){
            $wo = explode(" ",$string);
            $c=0;
            $return='';
            foreach ($wo as $piece){
                $c++;
                if($words>$c)
                    $return .= " ".$piece;
            }
            return $return;
        }
    
        /**
        * The Widget
        */
        class SimpleRssWidget extends WP_Widget {
            /** constructor */
            function SimpleRssWidget() {
                parent::WP_Widget(false, $name = 'Simple RSS Feed');
            }
    
            /** @see WP_Widget::widget */
            function widget($args, $instance) {
                //get arguments
                extract( $args );
    
                //set title var
                $title = 'Simple Rss Widget';
    
                //get title
                if(isset($instance['title']))
                    $title = apply_filters('widget_title', $instance['title']);
    
                //get limit
                $limit = 5;
                if(isset($instance['limit']))
                    $limit = $instance['limit'];
    
                //get shorten
                $shorten = 0;
                if(isset($instance['shorten']))
                    $shorten = $instance['shorten'];
    
                //get hide_description
                $hide_description = 0;
                if(isset($instance['hide_description']))
                    $hide_description = $instance['hide_description'];
    
                //get url
                $url = '';
                if(isset($instance['url']))
                    $url = $instance['url'];
    
                echo $before_widget; 
    
                if ( $title )
                    echo $before_title . $title . $after_title;
    
                $i = 0;
                $url = html_entity_decode($url);
                $xml = simplexml_load_file($url);
                $return = "";
                $return .= "<ul class=\"wp-simple-rss-list\">";
                foreach($xml->channel->item as $item) {
                    if($i == $limit) break;
                    $titel = $item->title;
                    $link = $item->link; 
    
                    if( $shorten == 1 )
    
                    	$titel = substr($titel,0,30).'...';
    
                        $return .= ' <li><h3><a href="'.$link.'" target="_blank" title="'.($titel).'" target="_blank" class="wp-simple-rss-link">'.($titel).'</a></h3>';
    
                        if($hide_description == 0)
                       		$return .= '<span>'.(SimplRssfirstWords($item->description,15)).'...</span><br />'; 
    
                       	$return .= '</li>';
    
                    $i++;
                }
                $return .= "</ul><br /><a href=\"".$xml->channel->link."\" class=\"wp-simple-rss-feed-url\">".$xml->channel->link."</a>";
                echo $return;
                echo $after_widget;
    
            }
    
            /** @see WP_Widget::update */
            function update($new_instance, $old_instance) {
                $instance = $old_instance;
                $instance['url'] = strip_tags($new_instance['url']);
                $instance['limit'] = (int)($new_instance['limit']);
                $instance['title'] = strip_tags($new_instance['title']);
                $instance['shorten'] = (int)($new_instance['shorten']);
                $instance['hide_description'] = (int)($new_instance['hide_description']);
                return $instance;
            }
    
            /** @see WP_Widget::form */
            function form($instance) {
                if(isset( $instance['title'] ))
                    $title = esc_attr($instance['title']);
                else $title = '';
    
                if(isset( $instance['limit'] ))
                    $limit = (int)($instance['limit']);
                else $limit = 5;
    
                if(isset( $instance['shorten'] ))
                    $shorten = (int)($instance['shorten']);
                else $shorten = 0;
    
                if(isset( $instance['url'] ))
                    $url = esc_attr($instance['url']);
                else $url = '';
    
                if(isset( $instance['hide_description'] ))
                    $hide_description = (int)($instance['hide_description']);
                else $hide_description = 0;
            ?>
            <p>
                <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>
                <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>
    
                <br />
                <label for="<?php echo $this->get_field_id('url'); ?>"><?php _e('Feed url:'); ?>
                <input class="widefat" id="<?php echo $this->get_field_id('url'); ?>" name="<?php echo $this->get_field_name('url'); ?>" type="text" value="<?php echo $url; ?>" /></label>
    
                <br />
                <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('No# messages:'); ?>
                <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label>
    
                <br />
                <label for="<?php echo $this->get_field_id('shorten'); ?>"><?php _e('Shorten link:'); ?> &nbsp;
                <input type="checkbox" id="<?php echo $this->get_field_id('shorten'); ?>" value="1" name="<?php echo $this->get_field_name('shorten'); ?>" <?php if($shorten == 1) echo 'checked="checked"'; ?> /></label>
    
                <br />
                <label for="<?php echo $this->get_field_id('hide_description'); ?>"><?php _e('Hide description:'); ?> &nbsp;
                <input type="checkbox" id="<?php echo $this->get_field_id('hide_description'); ?>" value="1" name="<?php echo $this->get_field_name('hide_description'); ?>" <?php if($hide_description == 1) echo 'checked="checked"'; ?> /></label>
            </p>
            <?php
        }
    
    }
    
    add_action('widgets_init', create_function('', 'return register_widget("SimpleRssWidget");'));
    
    /**
    * Short tag function
    *
    * @param mixed $url
    */
    
    function wp_simple_rss_feed_reader($url,$limit=50){
    	$url = html_entity_decode($url);
        $xml = simplexml_load_file($url); 
    
        $return .= "";
        $i=0;
        foreach($xml->channel->item as $item)
        {
        	$i++;
    
            $titel = $item->title;
            $link = $item->link;
                $return .= ' <li><a href="'.$link.'" target="_blank" title="'.($titel).'" class="wp-simple-rss-link">'.($titel).'</a>
               <span>'.($item->description).'</span><br /> </li> ';
            if($i == $limit) break;
        }
        $return .= "";
        return $return;
    }
    
    /**
    * Include the shortscriptfunctions for rss
    *
    * enables:
    * [simple-rss feed="http://www.xxx.feed"]
    *
    */
    function wp_simple_rss_feed_shorttag($atts) {
        extract(shortcode_atts(array(
        'feed'         => '',
        'limit'         => ''
        ), $atts));
    
        return wp_simple_rss_feed_reader($feed,$limit);
    }
    //add shortcodes
    add_shortcode( 'simple-rss', 'wp_simple_rss_feed_shorttag');
    ?>
  5. Aloysius314
    Member
    Posted 1 year ago #

    I had a similar problem with the widget title and was able to correct it with CSS

    #rss-2 h2 a {
    color: #ffffff;
    }

    Hope this helps :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.