• Resolved stemie

    (@stemie)


    When I set this plugin to open in a new window, The read more tag at the end of the excerpt does not open in a new window. If I click the post title it does.

    So in short the open in new window option is not working for all permalinks for a redirected post, in particular the read more link. Any ideas how I can over come this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Are you still having this issue?
    Let me know if you are – I can give you a few suggestions.

    Warm regards,
    Don Fischer

    Thread Starter stemie

    (@stemie)

    Yes it is still and issue for me.
    Its just the read more tags that wont open in a new window. The other links work.

    Thanks Don

    Stemie,
    You can try filtering the read more link by adding the following to your functions.php file: [ edited code – was incorrect (Don) ]

    //make more link open in new window
    function add_blank_to_link($link) {
    	$pos = strpos($link, 'a href');
    	if ($pos) {
    		global $post;
    		global $redirect_plugin;
    		$global_new_window_setting = $redirect_plugin->get_value('ppr_newindow'); //check the individual item to see if there is a new win setting.
    		$qpprp_newwin = get_post_meta($post->ID,'_pprredirect_newwindow',true); //get global override of new win setting if there is one.
    		$hastarget = strpos($link,'target='); //check to see if it already has a target.
    		if(($qpprp_newwin == 1 || $global_new_window_setting == 1) && $hastarget === false){
    			//if individual setting says yes, or global setting says yes, AND it does not already have a traget, add one.
    			$link = substr_replace($link, 'a target="_blank" href', $pos, 6);
    		}
    	}
    	return $link;
    }
    add_filter('the_content_more_link', 'add_blank_to_link');

    This will filter the link and add the new window target attribute if either the individual page/post new window box is checked or the global new window box is set AND it does not already have a target set up.

    I have not tested this – but it should work fine. If you have a problem, please let me know.

    Warm regards,
    Don

    Thread Starter stemie

    (@stemie)

    Thanks Don that seems to have done the trick 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Quick Page/Post Redirect Plugin – read more tag doesnt open in new window’ is closed to new replies.