Set A Page To A Single User
Hi Folks can anyone help me on this matter it has been bugging me for weeks and i cant find a solution, i have had a good response before but it doesn't quite do what i need it to do.
]/what i am trying to achieve is that i want to create a page and then somehow allow only posts from a certain user to display in it. i don't want to that user to be logged in all the time so others can view there posts. here is the code that was recommended before
is there a way of changing the variable below to allow posts by a specific user to be displayed something like:
if page = id_4 and if posts belong to user_id 122 display there posts
thanks in advance Chris
<?php
//This sets the $curauth variable
if ( isset($_GET['author_name']) ) :
$curauth = get_user_by('login', $author_name);
else :
$curauth = get_userdata( intval($author) );
endif;
?>
<?php appthemes_before_loop(); ?>
<?php query_posts( array('posts_per_page' => 10, 'post_type' => APP_POST_TYPE, 'post_status' => 'publish', 'author' => $curauth->ID) ); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php appthemes_before_post(); ?>
<div class="post-block-out">
<div class="post-block">
<div class="post-left">
<?php if ( get_option('cp_ad_images') == 'yes' ) cp_ad_loop_thumbnail(); ?>
</div>
<div class="<?php if ( get_option('cp_ad_images') == 'yes' ) echo 'post-right'; else echo 'post-right-no-img'; ?> <?php echo get_option('cp_ad_right_class'); ?>">
<?php appthemes_before_post_title(); ?>
<h3><a href="<?php the_permalink(); ?>"><?php if ( mb_strlen( get_the_title() ) >= 75 ) echo mb_substr( get_the_title(), 0, 75 ).'...'; else the_title(); ?></a></h3>
<div class="clr"></div>
<?php appthemes_after_post_title(); ?>
<div class="clr"></div>
<?php appthemes_before_post_content(); ?>
<p class="post-desc"><?php $tcontent = strip_tags( get_the_content() ); if ( mb_strlen( $tcontent ) >= 165 ) echo mb_substr( $tcontent, 0, 165 ).'...'; else echo $tcontent; ?></p>
<?php appthemes_after_post_content(); ?>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div><!-- /post-block -->
</div><!-- /post-block-out -->
<?php appthemes_after_post(); ?>
<?php endwhile; ?>
<?php appthemes_after_endwhile(); ?>
<?php else: ?>
<?php appthemes_loop_else(); ?>
<?php endif; ?>
<?php appthemes_after_loop(); ?>
<?php wp_reset_query(); ?>