WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Add URL to child title on parent post page

[Resolved] Add URL to child title on parent post page

  • Hello,

    I would like to add a link that goes from the parent post page to the child post page.

    I so far have the following code which displays the title of the child post : `<?php $child_posts = types_child_posts(‘students’);
    foreach ($child_posts as $child_post) {
    echo “‘.$child_post->post_title.'”;
    } ?>`

    I would like to turn this into a link to the post, is this possible??

    Thanks

    http://wordpress.org/extend/plugins/types/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I got the below to work, probably not the best code in the world but does the job.

    How would do the same, add link, image and title for the Parent custom posts page on the Child page??

    $child_posts = types_child_posts('students');
    
            foreach ($child_posts as $child_post) {
    
            $var_i = get_the_post_thumbnail( $child_post->ID );
    	$var_l = post_permalink( $child_post->ID );
    	$var_t = $child_post->post_title;
    
                echo "<div style='float:left; text-align:center;width:300px;display:inline-block;padding-right:5px;'>";
                echo "<a href='".$var_l."'>".$var_i." </a>";
    			echo "<p><a href='".$var_l."'>".$var_t."</a></p></div>";

    Dear Thaiso,

    That is correct.

    [ Signature moderated. ]

    Hi,

    How would I go about placing the same: a link, thumbnail and post title of the parent post on the child post?

    Thanks

    Dear Thaiso,

    Please check this link http://codex.wordpress.org/Function_Reference/get_post_ancestors . Hope it will help you.

    Please open a new thread, if you still having any issues. Because this one is resolved.

    [ Signature moderated. ]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Add URL to child title on parent post page’ is closed to new replies.