Support » Plugins and Hacks » Custom feed of Video Category link back to post?

  • Resolved Kirk T

    (@kirk-t)


    The Problem
    When users subscribe by email, embedded videos do not appear in the email. The subscriber doesn’t know a video has been posted unless stated in the title or text of the post.

    The Solution
    Automatically include a “Click Here to view the Video” link in the feed on all posts in the “Video” category. Even though email subscribers still won’t see the video in their email, they will know a video has been posted because of the link at the bottom of the posts.

    I’ve added the following code to my theme’s function file, however, the template tags used for the permalink and title do not work at all. I can’t figure out how to make this function output the correct link back to the post. Any suggestions?

    add_filter('the_content','video_feed');
    function video_feed($content) {
    	if ( is_feed() && in_category('Video') ) {
    		$content = $content . '<p><a href="<?php the_permalink(); ?>" title="View the Video for <?php the_title(); ?>">Click Here</a> to view the video.</p>' ;
    	}
    	return $content;
    }

    Here’s a live version of the above code:

    http://1010children.com/category/video/feed/

Viewing 1 replies (of 1 total)
  • The Working Solution

    Simple fix – I just used get_the_permalink() and get_the_title() instead. Everything seems to be working great. Below is the final code used.

    add_filter('the_content','video_feed');
    function video_feed($content) {
    	if ( is_feed() && in_category('Video') ) {
    		$content = $content . '<p><a href="' . get_permalink() . '" title="View the Video for ' . get_the_title() . '">Click Here</a> to view the video.</p>';
    	}
    	return $content;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Custom feed of Video Category link back to post?’ is closed to new replies.