Viewing 6 replies - 1 through 6 (of 6 total)
  • How can I add RMRH plugin only to ONE template page?

    I de-activate the plugin and in a Template page after the code

    <!-- The query -->
    	<?php query_posts('cat=23&tag=episodi&order=ASC');

    I just add:

    function wt_rmrh_morelink_filter($link)
    {	global $post;	$target = "class=\"";
    	$pos = strpos($link,$target);
    
    	$newClass = "rmrh-postId-". $post->ID;
    
    	// the 'class' has been completely removed, add it back
    	if($pos === false)
    	{
    		$target = "<a ";
    		$pos = strpos($link,$target);
    		$replacement = "class=\"" . $newClass . "\" ";
    	}
    	else
    	{
    		$replacement = $newClass . " ";
    	}
    
    	$at = $pos + strlen($target);
    	$result = substr_replace($link, $replacement,$at,0);
    
    	return $result;
    }
    
    add_filter('the_content_more_link', wt_rmrh_morelink_filter, 999);
    
    		global $more;
    		// set $more to 0=chiusa, set $more to 1=aperta
    		$more =0;
    	?>

    So any class=”more-link” are changed into class=”rmrh-postId-555 more-link”

    and now?

    RESOLVED:
    and now…
    modify read-more-right-here.php
    delete all the code from
    function wt_rmrh_morelink_filter
    to
    add_filter('the_content_more_link', wt_rmrh_morelink_filter, 999);

    uploading this modified page overwriting the old read-more-right-here.php

    Activate plug in admin plugin page
    et voilà!!

    Only in the templates page where you added the more link filter code after the query has a RMRH functions!!!

    Yatta!!

    Plugin Author Wooliet

    (@wooliet)

    I had to look up “Yatta”. I like that word.

    Glad you got it working! I guess the goal here is to add something so that that the plugin is only activated within a particular template.

    Here’s what I’m thinking. I can’t test anything right now so please let me know if I’m way off here, but:

    1. You can remove the ‘more link’ filter using remove_filter (reference) within your other theme files. E.g.:

    remove_filter('the_content_more_link', wt_rmrh_morelink_filter);

    2. Within the template where you do want the plugin to work, just add the global $more;$more = 0; code before your call to the_content. (And obviously done’t call remove_filter)

    This way you’re not messing with the actual plugin code. Does that make sense? Would that work?

    Plugin Author Wooliet

    (@wooliet)

    poosk: Does any of the above help you? If you’ve got a template setup for display posts within that particular category, then I would think that what is described above might be useful in solving your issue.

    Hello Wooliet!

    Most of the blog is without RMRH and only ONE page with many post (templatize page) have RMRH options.
    So is easier to have all blog without rmrh-postId- and put code ONLY for the templatized page.

    Saving this page as a template and use it with ‘post template plugin’ is easy to use!

    If you want see https://www.newbokan.net (w/o rmrh-postId-) and https://www.newbokan.net/index/index.php/episodi/ with rmrh-postId-

    Is a page with a post of category “Yattaman08” and tag “episodi”

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Read More Right Here] one category only?’ is closed to new replies.