Results 1 to 2 of 2

Thread: Set A Page To A Single User

  1. #1
    Thread Starter
    Veteran chriswareham's Avatar
    Join Date
    Apr 2012
    Location
    Staffordshire, UK
    Posts
    296
    Thanks
    18
    Thanked 40 Times in 38 Posts

    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(); ?>

  2. #2
    Veteran ajamm's Avatar
    Join Date
    Nov 2011
    Location
    New Zealand
    Posts
    309
    Thanks
    26
    Thanked 32 Times in 29 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. WP Upload failure...2.9.3 to 3.0.2 single user version
    By andyclassipress in forum Help Using ClassiPress
    Replies: 1
    Last Post: June 11th, 2010, 06:49 PM
  2. Limit the number of free ads a single user can publish
    By karlo in forum ClassiPress General Discussion
    Replies: 1
    Last Post: May 16th, 2010, 06:17 AM