This topic is: not resolved
- This topic has 0 replies, 1 voice, and was last updated 6 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘General Discussion’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Community Forums › Forums › Archived Forums › General Discussion › Agent Profile for AgentPress Pro
Tagged: Agentt Press, Author Profile
I have created an autor.php file for author profile, I use AgentPress Pro, the file shows the author-box, also shows only the author's listings (That is the idea, I don’t want to show the author posts)
I would like to know if the code is correct, or if there is any way to improve it.
I don`t know much about code, everything I do is looking for tutorials and experimenting, so I would like someone to value the code
<?php get_header();
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;?>
<section class="public-profile">
<div class="author-box">
<div class="avatar"><?php echo get_avatar( $curauth->user_email , '120'); ?></div>
<h3 class="author-box-title"><?php echo $curauth->nickname; ?>:</h3>
<p class="author-box-content"><?php echo $curauth->user_description; ?><br />
<a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
</div></section>
<!-- Show just listings from the author -->
<?php $args = array(
'post_type' => 'listing' ,
'author' => get_queried_object_id(), // this will be the author ID on the author page
'showposts' => 10
);
$custom_posts = new WP_Query( $args ); ?>
<?php if ( $custom_posts->have_posts() ): ?>
<div class="author-by"><h5>Proximos eventos de: <?php echo $curauth->nickname; ?></h5>
<span class="dashicons dashicons-arrow-down-alt2"></span></div>
<div class="flex-container"> <?php while ( $custom_posts->have_posts() ) : $custom_posts->the_post(); ?>
<div class="author-listing-title">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>
</div>
<?php endwhile; ?>
<?php else: ?>
<p><?php _e('User has no Listings'); ?></p>
<?php endif; ?></div>
<!--LOOP ENDS-->
<?php get_footer(); ?>
https://www.facebook.com/angeloaguilarq
© 2025 WPEngine, Inc.