WordPress.org

Ready to get started?Download WordPress

Forums

Getting movie and serial on actor page (1 post)

  1. TataVostru
    Member
    Posted 1 year ago #

    I'm building a cinema site, I came with a problem, let me explain:

    *Movies- are stored in Post's
    *Actors- are stored in Post Type - persoane ( taxonomy= lista)
    *Serials - are stored in Post Type - serial ( taxonomy= seriale)

    I use Advance Custom Field to link the Person to the movie -

    AFC (http://www.advancedcustomfields.com/)

    How i add: I add new actor post to post type ( persoane), after i add the movie( in post's), in sidebar(post's, movie page) i link the actor (http://i49.tinypic.com/a8800.jpg). After i Link the actor on the actor page it display the movie's that actor play in

    I use this code to do that

    <?php
    //create new loop query for films by this actor
    $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'distributie' AND meta_value LIKE '%".get_the_ID()."%'");
    $the_query = new WP_Query( array( 'post__in' => $movies) );
    
    // The Loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
        echo '<div class="actor-box-related"><a class="actor-titlu" href="';
        the_permalink();
        echo '" title="'.get_the_title().'">';
        ?>
        <img class="actor-img" src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=90&w=60&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>
    
        <?php the_title();
        echo '</a></div>';
    endwhile;
    
    // Reset Post Data
    wp_reset_postdata();
    ?>

    The problem:

    I create a Post Type - serial where I add the Serials (Ex: heroes,prisonbreak... )

    How can i display on the actor's page the serials that actor play in.

    The up code get me only the movies from post's, how can i get the movies from that PostType (serial).

    Can I put both together to get movies and serials? Or how can i display the serial's on actor page, and IF no movie or serial is atach retrive the text "No movies for this actor"

    Thanks in advance for those who help me.

    [Please do not bump - it's only been one hour - if you need faster help, consider hiring someone: http://jobs.wordpress.net/ ]

Topic Closed

This topic has been closed to new replies.

About this Topic