Viewing 2 replies - 1 through 2 (of 2 total)
  • I don’t get a persistent ‘read more’ link, it just disappears entirely.

    I have modified the files and can get a ‘close’ link at the end, but can’t get the ‘more’ link back afterwards. Just a warning – I don’t know much about js and sort of fudged this together. Anyone got any suggestions?

    Javascript file (pobo_rmi.js)

    var $j = jQuery.noConflict();
    
    $j('document').ready(function(){
    	$j('.readmoreinline').hide();
    	$j('.close').hide();
    	$j('.more-link').click(function(e){
    		e.preventDefault();
    		$j(this).empty().parent().next('.readmoreinline').show();
    		$j('.close').show(); 
    
    			$j('.close').click(function(e){
    	$j('.readmoreinline').hide();
    	$j('.close').hide();
    	});
    	});
    
    });

    read-more-inline.php

    function pobo_rmi_morelink_filter($link){
    	global $post;
    	$my_id = $post->ID;
    	 //$spanId = "more-" . $post->ID;
    		$post_object= get_post($my_id);
    		$content = $post_object->post_content;
            // grab only the stuff after 'more'
            $debris = explode('<!--more-->', $content);
    
    	$link.='</p><p class="readmoreinline">'.$debris[1].'</p><a class="close">close</a>';
    	return $link;
    }
    
    add_filter('the_content_more_link', pobo_rmi_morelink_filter, 999);

    Update: adding a blank link to the ‘close’ tag works as it will reload the page.

    function pobo_rmi_morelink_filter($link){
    	global $post;
    	$my_id = $post->ID;
    	 //$spanId = "more-" . $post->ID;
    		$post_object= get_post($my_id);
    		$content = $post_object->post_content;
            // grab only the stuff after 'more'
            $debris = explode('<!--more-->', $content);
    
    	$link.='</p><p class="readmoreinline">'.$debris[1].'<a class="close" href="">(close)</a></p>';
    	return $link;
    }
    
    add_filter('the_content_more_link', pobo_rmi_morelink_filter, 999);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding READ LESS to bottom?’ is closed to new replies.