link to the parent of the current post.
-
I’m trying to put a link to the parent of the current page in the sidebar and I can’t get the syntax right. I have taken the code form the get_post reference in the codex but I don’t know what ‘ ->’ means and I haven’t been able to find a reference to it on the web.
The code I’m using is:
`<?php
$parent_id=($post->post_parent);
echo $parent_id;$parent_post?=?get_post($parent_id);?
$parent_title = ($parent_id->post_title);
echo $parent_title;
?> `I get: Parse error: syntax error, unexpected T_VARIABLE on line 23
which is
$parent_title = ($parent_id->post_title);
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘link to the parent of the current post.’ is closed to new replies.