• Resolved freshifreshy

    (@freshifreshy)


    I’d like to be able to use the more tag to hide the rest of the post, but then show when you click on the “read more” link, as opposed to forwarding to the post’s permalink.

    Any thoughts on how I could do this?

Viewing 1 replies (of 1 total)
  • Thread Starter freshifreshy

    (@freshifreshy)

    Figured it out. I’m using a function like this.

    function the_dynamic_content() {
    
    	global $page, $pages;
    
    	$content = $pages[$page-1];
    
    	if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
    
    		$content = explode($matches[0], $content, 2);
    
    		$before_more = apply_filters('the_content', $content[0]);
    		$before_more = str_replace(']]>', ']]>', $before_more);
    
    		$after_more = apply_filters('the_content', $content[1]);
    		$after_more = str_replace(']]>', ']]>', $after_more);
    
    		echo '<div class="teaser">'.$before_more.'</div>';
    		echo '<div class="more"><div>'.$after_more.'</div></div>';
    
    		echo '<div class="more-link"></div>';
    
    	} else {
    
    		$content = apply_filters('the_content', $content);
    		$content = str_replace(']]>', ']]>', $content);
    		echo $content;
    
    	}
    
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Dynamic More Tag’ is closed to new replies.