0

How can i display movies added by an editor in profile page, i mention that the user (editors) have capabilities to add movies.

I shoud use a querry? with args?

I mention that the post_type is "post" - for movies ////// "trailers" - for trailers

I want to get movies and trailers on the profile user page. How can i do that?

----------------------------------- UPDATED -------------------
    <?php
    global 
    $current_user; 
    $current_user = wp_get_current_user();
    $recentPosts = new WP_Query();
    $recentPosts->query(array(
        'author' => $current_user->ID,
        'post_type' => 'post'));
    ?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>

    <div class="bposter">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Film %s'), the_title_attribute('echo=0')); ?>">
    <img src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=120&w=90&zc=1" alt="" title="<?php the_title(); ?>" /></a>
    <div class="bpt"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>">
    <?php the_title(); ?>
    </a></div>
    </div>
    <?php endwhile; ?>
    </div>
----------------------------------- UPDATED -------------------

Here is an image how it look's http://s12.postimg.org/ssacplu3x/filme.jpg Thanks.

3
  • this code is not working, it retrive me the movies but same movies on diferent users... – Batman Apr 16 '13 at 0:33
  • 1. query_posts() is not recommended. Use new WP_Query instead. 2. $current_user->ID must not be set. Try a var_dump($current_user); to see what is in that variable. Wish I could help more but I am on a deadline for my own project. – helgatheviking Apr 16 '13 at 0:41
  • thanks for your answer it seem is working, but how can i retrive all the movies, i retrive only the amount set in Administrtor setings. How can i retrive the pages too. – Batman Apr 16 '13 at 1:07
3

how can i retrive all the movies, i retrive only the amount set in Administrtor setings. How can i retrive the pages too

Assuming that $current_user->ID is now correct, and it seems from your comment that it is.

$recentPosts = new WP_Query();
$recentPosts->query(
    array(
        'author' => $current_user->ID,
        'post_type' => array('post','trailers'), // pull both posts and trailers
        'showposts' => -1, // show all posts
        'ignore_sticky_post' => true // my addition, seems like a good idea
    )
);

Reference

https://codex.wordpress.org/Class_Reference/WP_Query#Parameters

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.