Forums

[Plugin: FWP-Limit-Size-of-Posts] Expanding Content - PHP Help Please! (1 post)

  1. misterpatrick67
    Member
    Posted 1 year ago #

    Hello all,

    I am using the FWP feed syndication with the add-on Limit-Size-of-Posts. This works great except that it limits the size of the post everywhere and I want it to only limit the content on the homepage. I need images within the truncated excerpts which is why I have gone this way.

    Here is the function within the plugin:

    function the_content ($content) {
    		// Only affects syndicated posts
    		if (is_syndicated()) :
    			// Get a SyndicatedLink object for the source of this
    			// syndicated post.
    			$link_id = get_syndication_feed_id();
    			$link = new SyndicatedLink($link_id);
    
    			$rule = $link->setting('limit size of posts', $this->name.'_limit_size_of_posts', NULL);
    			// Rules are stored in the format array('metric' => $count, 'metric' => $count);
    			// 'metric' is the metric to be limited (characters|words)
    			// $count is a numeric value indicating the maximum to limit it to
    			// NULL indicates that no limiting rules have been stored.
    
    			if (is_string($rule)) : $rule = unserialize($rule); endif;
    
    			// Only operate in a feed context if we have permission
    			$haveRule = is_array($rule);
    			$feedChecks = (!is_feed() or (isset($rule['rss']) and $rule['rss']));
    			if ($haveRule and $feedChecks) :
    				$content = $this->filter($content, $rule);
    			endif;
    		endif;
    		return $content;

    I was thinking I could just add something like this to the first part:

    if (is_syndicated() && is_home()) :

    but it doesn't work. Anyone know a way around this or a different method for doing this? Thanks a ton!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.