Support » Fixing WordPress » embedded objects and <!—more–> tag

  • I have several posts with embedded objects (flash games) which load automatically. If I insert them in the first post lines, the page with the posts list will take too much time and memory to load. So, I have to move the embedded object tags after the <!—more–> tag, and insert a screenshot image just before the <!—more–> tag to make the user understand which object he can see in the single post page.
    However, in the single post page, the screenshot just before the embedded object become totally useless.
    I ask if there is a method to make some part of the post (in this case the screenshot image) appear only in the posts list page (the one that write the first lines of each post before the <!—more–> tag) but not in the single post page.
    Otherwise, is there another solution?

Viewing 1 replies (of 1 total)
  • Adding the following function to your themes’ functions.php file should do the trick:

    add_filter( 'the_content', 'mfields_trim_teaser' );
    if( !function_exists( 'mfields_trim_teaser' ) ) {
    	function mfields_trim_teaser( $content ) {
    		if ( is_single() && preg_match( '/<span id="more-(.*?)?">/', $content, $matches ) ) {
    			$parts = explode( $matches[0], $content, 2 );
    			if( isset( $parts[1] ) && !empty( $parts[1]	 ) )
    				$content = $parts[1];
    		return $content;
Viewing 1 replies (of 1 total)
  • The topic ‘embedded objects and <!—more–> tag’ is closed to new replies.