Support » Fixing WordPress » Show ancestor of a Custom Post Type

  • Hi guys 🙂
    Well, the thing is, i have a custom post type named DISCOGRAFIA wich is a parent of MUSICA.
    Well, in single-musica.php i have the content shown up, but i need to get the thumbnail and some custom fields from its parent on DISCOGRAFIA
    eq: post type musica ID 222 is child of discografia id 20.
    When showing musica 222 content, i want to retrieve discografia 20’s thumbnail.

    I tried ´`$parents = get_ancestors($post->ID, ‘musica’);
    echo $parents;
    it prints an empty array

    i tried
    ´`echo $post->post_parent;
    $argss = array(
    ‘p’ => $post->post_parent
    $parent = new WP_Query( $argss );

    while( $parent->have_posts() ) : $parent->the_post();
    echo $post->ID;

    echo get_the_post_thumbnail( $post->ID, array(100,100) );
    all empty again…

    well, im using “types plugin” to manage custom post types and fields. it has some documentation with custom functions, but none for what i want.

    =) hope someone can help me

  • The topic ‘Show ancestor of a Custom Post Type’ is closed to new replies.