I tried separating the content of an article before the <!--more-->
Tag from the rest in Wordpress.
I have two columns:
<!--more-->
Tag.<!--more-->
Tag.I used the following code to separate both parts: This is the "sub-title"
<h2><?php global $more; $more=0; the_content(''); $more=1; ?></h2>
This is the rest of the article.
<?php the_content( '', true ); ?>
Everything works, but I have two artifacts left.
<p class="p1">...text...</p>
<p><span id="more-15"></span></p>
How can I get rid of the artifacts? I really have now idea and they are screwing with my layout.
Thanks!
This should work to get you going.
<?php
//Output sub-title
global $more;
$more = 0;
$out = apply_filters( 'the_content', get_the_content('') );
$out = str_replace( ']]>', ']]>', $out );
$out = strip_tags( $out, '<br><a><em><u><strong>' ); //may need to add more tags
echo '<h2>'.$out.'</h2>';
$more = 1;
?>
<?php
//Output content
$out = apply_filters( 'the_content', get_the_content('', TRUE ) );
$out = str_replace( ']]>', ']]>', $out );
$repl = '<p><span id="more-' . get_the_ID() . '"></span></p>';
$out = str_replace($repl, '', $out);
echo $out;
?>
A better approach would be to make these as filters for the_content
, but without knowing your whole site structure, this could introduce other layout errors.