Skip to main content

get Get post content intro text on category.php?

OK - so forFor 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.phpcategories.php.

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

ButHowever it doesn't work and breaks the loop.

theThe error iI get is - Fatal error: Only variables can be passed by reference in /var/www/vhosts/penoyreprasad.com/httpdocs/wp-content/themes/pap_01/loop.php on line 39

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'veI've tried resetingresetting post data &and rewinding the loop after this but nothing helps. And print_r($secintro);print_r($secintro); does show anything either.

Any help appreciated

get post content intro text on category.php?

OK - so 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.

But it doesn't work and breaks the loop.

the error i get is - Fatal error: Only variables can be passed by reference in /var/www/vhosts/penoyreprasad.com/httpdocs/wp-content/themes/pap_01/loop.php on line 39

and line 39 is

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

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

Any help appreciated

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.

Source Link
v3nt
  • 1.7k
  • 7
  • 36
  • 54

get post content intro text on category.php?

OK - so 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.

But it doesn't work and breaks the loop.

the error i get is - Fatal error: Only variables can be passed by reference in /var/www/vhosts/penoyreprasad.com/httpdocs/wp-content/themes/pap_01/loop.php on line 39

and line 39 is

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

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

Any help appreciated