WordPress.org

Ready to get started?Download WordPress

Forums

Adding RSS message to Plaftform theme (4 posts)

  1. Nehemoth
    Member
    Posted 2 years ago #

    Hi there

    I'm using the free version of the Theme Platform from Pagelines and I would like to do some modifications to add extra functionality.

    First in my RSS instead of "[...]" (without the quotes) I would like to use something like "Continue Reading..", just like in every post on the site. [www.miwp.net]

    And also I would like to display less words in excerpt.

    How can this be accomplish?

    Thank you

  2. pixel-Jay
    Member
    Posted 2 years ago #

    For the RSS feed, Customizing Feeds,

    As for the excerpt, in your theme folder there should be a folder called includes, in that folder is a file named library.functions.php. The function for the excerpt length is around line 500 -> $excerpt_length = apply_filters('excerpt_length', 25);, the number after 'excerpt_length' is where you can change the length.

    If you're using a child theme, it's a bit different, you would be able to define your own custom excerpt functions.

    Hope that helps

  3. Nehemoth
    Member
    Posted 2 years ago #

    @pixel-Jay thank you, I changed the default excerpt_length and everything is working like a charm.

    Now lets see if someone helps me add the continue reading or whatever message.

    Thank You

  4. Nehemoth
    Member
    Posted 2 years ago #

    I know that this is the function/part that I need to change but everything that I tried to change doesn't get me to far. I just need to get a link/url to the original post instead of the [...] just in the RSS/feed

    * Overrides default excerpt handling so we have more control
     *
     * @since 1.2.4
     */
    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');
    function improved_trim_excerpt($text) {
    
    	// Set allowed excerpt tags
    	$allowed_tags = (pagelines_option('excerpt_tags')) ? pagelines_option('excerpt_tags') : '<p><br><a>';
    
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    
    		$text = preg_replace('@<script[^>]*?>.*?</script>@si', '', $text); // PageLines - Strip JS
    
    		$text = str_replace(']]>', ']]>', $text);
    
    		$text = strip_tags($text, $allowed_tags); // PageLines - allow more tags
    
    		$excerpt_length = apply_filters('excerpt_length', 45);
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
    		$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
    		if ( count($words) > $excerpt_length ) {
    			array_pop($words);
    			$text = implode(' ', $words);
    			$text = $text . $excerpt_more;
    		} else {
    			$text = implode(' ', $words);
    		}
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }

Topic Closed

This topic has been closed to new replies.

About this Topic