Skip to main content

Get post content intro text on category.php?

For some categories on my site there's introduction text that needs formatting (so using the category description isn't an option) and placing at the top of categories.php.

I've added a post ID to the category description field thinking I could then use get_post() to load the relevant post's content then list all the posts in the category underneath.

However it doesn't work and breaks the loop.

The error I get is

Fatal error: Only variables can be passed by reference in /wp-content/themes/pap_01/loop.php on line 39

and line 39 is

$secintro = get_post(439);
print_r($secintro);

I've tried resetting post data and rewinding the loop after this but nothing helps. And print_r($secintro); does show anything either.

v3nt
  • 1.7k
  • 7
  • 36
  • 54