get_the_content() doesn’t work in single view?
It seems that if I call
get_the_contentwhen i’m in a single view, it doesn’t return anything.
Is this true or is my code bad?
if ((in_category(4)) or (in_category(6)))
if (($is_home) or ($is_single))
$localcontent = get_the_content("", true, "");
$loc = strpos($localcontent, "<!--split!-->");
$start = $loc + 13;
$end = strlen($localcontent) - $start;
$finalcontent = substr($localcontent, $start, $end);
Couple notes on the above code:
The use of local variables such as $is_single is because for some odd reason at this point in my code, calling the template boolean is_single() doesnt’t work right, so I cache them up before I start the_loop.
This code exists inside the_loop.
The code works perfect when i’m in a home view, but when i’m in a single post view, nothing is returned from
- The topic ‘get_the_content() doesn’t work in single view?’ is closed to new replies.