Displaying posts limit: can’t get pagination to display [duplicate]

Try reviewing this page on the codex. Using your above template, I would suggest the following: <?php if ( is_user_logged_in() ) : $args = array( ‘posts_per_page’ => ‘5’, ‘author’ => get_current_user_id(), // Removes a few lines of code 😉 ); $author_posts = new WP_Query( $args ); ?> <?php /* Author has posts? */ ?> <?php … Read more

Show posts containing or not custom field

The WP_Query class will automatically AND any filters that are set. In your case, using $query->set( ‘meta_query’, … ) means that WordPress will be looking for posts from the current author (because this is the author template) AND that have your custom meta key. From my understanding of your problem, this intentionally will never happen, … Read more

Create archives by author role

You may be able to abuse add_rewrite_endpoint for this purpose, depending on exactly what you want to do. Some examples: // add an endpoint // http:domain.com/role/ // http:domain.com/role/foo/ function wpa_add_role_endpoint(){ add_rewrite_endpoint( ‘role’, EP_ALL ); } add_action( ‘init’, ‘wpa_add_role_endpoint’ ); // check if a role parameter exists, like: // http:domain.com/role/foo/ function wpa_role_query( $query ){ if( $query->get(‘role’) … Read more

if else for custom $curauth-> field

A combination of get_queried_object_id to fetch the current user ID and get_user_meta to retrieve the banner should do the trick. <?php // somewhere in your theme’s author.php if ($img = get_user_meta(get_queried_object_id(), ‘user_banner’, true)) { // they uploaded an image, use it } else { // they did not upload the image, show the default }

Calling a custom profile field only it it exists

On an “author” page you can get a lot of the information you need with get_queried_object and additional information with get_user_meta. What you want (sounds like) should be in that second chunk of information.That is… $author = $wp_query->get_queried_object(); $ameta = get_user_meta($author->ID); var_dump($author,$ameta); // debugging if(!empty($ameta[‘facebook’])) { var_dump($ameta[‘yim’]); // debugging } // and so one for … Read more

Author template – separate custom post type by custom taxonomy term for $curauth

Got the answer, encase anyone else needs it, here it is. <?php $currauthor_id = get_the_author_meta(‘ID’); $terms = get_terms(‘your_taxonomy’, array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ) ); foreach ( $terms as $term ) { $myquery = new WP_Query( array( ‘author’ => $currauthor_id, ‘post_type’ => ‘post_type_name’, ‘your_taxonomy’ => $term->slug, ‘posts_per_page’ = > -1, … Read more

Get $curauth level

toscho is correct. User levels have been deprecated for a long time now. However, the following will get you the available information about the author of the posts on an author archive page. $author = get_queried_object(); var_dump($author); In that dump you should see everything you need, but use the role not the user level– look … Read more