mscgl
Forum Replies Created
-
Forum: Hacks
In reply to: split the content of the_content();Thanks ??
Forum: Hacks
In reply to: split the content of the_content();Hi
Got help from stackexchange.com So I share the solution for others can use.
put the code below in function.php
// split content at the more tag and return an array function split_content() { global $more; $more = true; $content = preg_split('/<span id="more-\d+"><\/span>/i', get_the_content('more')); // first content section in column1 $ret = '<div id="column1" class="column1">'. array_shift($content). '</div>'; // remaining content sections in column2 if (!empty($content)) $ret .= '<div id="column2" class="column2">'. implode($content). '</div>'; return apply_filters('the_content', $ret); }
and in single.php
<? echo split_content(); ?>
Thanks for your help and suggestions ??
Forum: Hacks
In reply to: split the content of the_content();Hi,
Thanks, tried deactivate the plugins, and activated one and one. still the same.
It seems that wp see the column 1 contents, is “all the content for the page” then start to load sidebar(), then sees the column 2 in the same wa and loads the facebook comment, linkwithin and shareaholic once again.
<div id="column1"> <p>test content column 1</p> <div class="fb-social-plugin fb-comments" data-href="https://test.co.uk/testarticle/" data-width="620"></div> </div> <div id="column2"> <p><span id="more-275"></span>the content of column 2 <div class="fb-social-plugin fb-comments" data-href="https://test.co.uk/testarticle/" data-width="620"></div>
very strange.
Thanks once again ??
Forum: Hacks
In reply to: split the content of the_content();Hi
Sorry, it’s the : <!–more–>, yes it correct.
I found something strange, after the first column the comment widget loads and then comes the column 2. and then loads the comment widget again.
That why I didn’t see the column 2, I didn’t scroll below the comments…
Do you have any idea ho to stop the loading the comments twice ?
It should only be loaded after the column 2.
thanks for your suggestions ??
Forum: Hacks
In reply to: split the content of the_content();Hi alchymyth,
Thanks for your suggestion, tried it but, still the out put is everything before <–more–>. Nothing after the <–more–>. ??
It seems
<div id="column2"> <?php the_content('',true); ?> </div>
is empty some how….