• Resolved cagdastakis

    (@cagdastakis)


    I have web site like a movie databese. i cretad fields for actors. and my normal posts are movie. I’m adding actors to movie troubleless and it shows in the movie like “Adam, Jane, Jessica”. But my problem is my actors field has a featured image and i want to show this names with their image in the movies.

    This is how i use actor names in movie;
    <strong>Actors::</strong> <?php print_custom_field('actors:to_link'); ?><br />

    What should i do to show their names with featured images’

    https://www.ads-software.com/plugins/custom-content-type-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor fireproofsocks

    (@fireproofsocks)

    It’s all about retrieving the custom fields of the referenced post. Usually for this I use the get_post output filter because it gets all of a post’s custom fields: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_post_OutputFilter

    See example #5 in particular.

    Thread Starter cagdastakis

    (@cagdastakis)

    i couldnt fix it.

    i used get_post like

    <?php
    // Use wp_get_attachment_image
    $related_post = get_custom_field('actors:get_post');
    $img = wp_get_attachment_image($related_post['thumbnail_id']);
    print $img;
    
    ?>

    but even names are not showing

    Plugin Contributor fireproofsocks

    (@fireproofsocks)

    It’s possible you don’t have the correct attribute: use print_r to show you what you have — if thumbnail_id doesn’t exist, you can’t use it.

    <?php
    $related_post = get_custom_field('actors:get_post');
    print_r($related_post);
    ?>

    If you are storing your image in a different field you have to use the correct field name. This is just PHP 101 at this point. Hope that helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showing with featured’ is closed to new replies.