Editar página de resultados de autor
-
Hola!
Me gustaría poder editar la página de resultados de autor de mi blog, con una cajita y la bio del autor, tipo lo que tienen estas webs:
https://www.searchenginejournal.com/author/dave-davies/
https://searchengineland.com/author/michelle-robbinsEs decir, poder poner algo de info sobre el autor y luego ya pues los posts, que es lo que se muestra ahora.
El código que genera la página de autor en mi tema es éste:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="share-post"> <?php if ( get_post_type() == 'post' ): ?> <div class="date-meta"><?php echo get_the_date( "d\<\i\>\ M\<\/\i\>\ " ) ?></div> <?php do_action( 'thim_social_share' ); ?> <?php endif ?> </div> <div class="content-inner"> <?php if ( get_post_type() == 'recipe' ) { $image = wp_get_attachment_image( get_post_thumbnail_id( get_the_ID() ), 'full' ); $name = esc_attr( get_the_title() ); $details = thim_get_recipe_details( $id ); ?> <div class="recipe-image"> <?php if ( function_exists( 'thim_get_recipe_details' ) ) { $details = thim_get_recipe_details(); $video_url = $details['video_url']; if ( $video_url ) { // Get the video URL from custom field $videoID = substr( $details['video_url'], 32 ); // Echo out the thumbnail, give it height and weight and set the alternate description to post title echo '<img class="video-img" src="http://i1.ytimg.com/vi/' . $videoID . '/maxresdefault.jpg" alt="' . get_the_title() . '">'; echo '<div class="wrap-play"><div class="play-button"><a href="' . esc_url( get_the_permalink() ) . '"><i class="fa fa-play"></i></a></div></div>'; } else { // else use the standard featured image echo wp_get_attachment_image( get_post_thumbnail_id( get_the_ID() ), 'full' ); } } ?> <a class="link" href="<?php echo esc_url( get_the_permalink() ); ?>"></a> <?php if ( is_plugin_active( 'comment-rating-stars/comment-star-reviews.php' ) ) : ?> <div class="rating-star"> <div class="rating-star-wrap"> <?php echo csr_get_overall_rating_stars( get_the_ID() ); ?> </div> </div> <?php endif; ?> </div> <?php } else { do_action( 'thim_entry_top', 'full' ); }?> <?php $theme_options_data = theme_options_data(); if ( !isset( $theme_options_data['thim_show_excerpt_post'] ) ) { $theme_options_data['thim_show_excerpt_post'] = 1; } ?> <div class="entry-content"> <?php if ( has_post_format( 'link' ) && thim_meta( 'thim_url' ) && thim_meta( 'thim_text' ) ) { $url = thim_meta( 'thim_url' ); $text = thim_meta( 'thim_text' ); if ( $url && $text ) { ?> <header class="entry-header"> <h3 class="blog-title"> <a class="link" href="<?php echo esc_url( $url ); ?>"><?php echo esc_html( $text ); ?></a> </h3> </header> <?php } ?> <div class="entry-summary"> <?php if ( $theme_options_data['thim_show_excerpt_post'] ) { the_excerpt(); } ?> </div><!-- .entry-summary --> <?php } elseif ( has_post_format( 'quote' ) && thim_meta( 'thim_quote' ) && thim_meta( 'thim_author_url' ) ) { $quote = thim_meta( 'thim_quote' ); $author = thim_meta( 'thim_author' ); $author_url = thim_meta( 'thim_author_url' ); if ( $author_url ) { $author = ' <a href=' . esc_url( $author_url ) . '>' . $author . '</a>'; } if ( $quote && $author ) { ?> <header class="entry-header"> <div class="box-header box-quote"> <blockquote><?php echo esc_html( $quote ); ?><cite><?php echo esc_html( $author ); ?></cite> </blockquote> </div> </header> <?php } } elseif ( has_post_format( 'audio' ) ) { ?> <?php the_title( sprintf( '<header class="entry-header"><h2 class="blog-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2></header>' ); ?> <div class="entry-summary"> <?php if ( $theme_options_data['thim_show_excerpt_post'] ) { the_excerpt(); } ?> </div><!-- .entry-summary --> <?php } else { ?> <div itemscope itemtype="http://schema.org/Blog"> <header class="entry-header"> <?php the_title( sprintf( '<h2 itemprop="name" class="blog-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> <?php thim_entry_meta(); ?> </header> <!-- .entry-header --> <div class="entry-summary "> <?php if ( $theme_options_data['thim_show_excerpt_post'] ) { the_excerpt(); } ?> </div><!-- .entry-summary --> </div> <?php }; ?> </div> </div> </article><!-- #post-## -->
Según entiendo, define un funcionamiento que hace que la página de autor se genere como una de archivos.
He encontrado este código en otra página, y creo que a lo mejor podría funcionar:
<?php // Set the Current Author Variable $curauth $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?> <div class="author-profile-card"> <h2>About: <?php echo $curauth->nickname; ?></h2> <div class="author-photo"> <?php echo get_avatar( $curauth->user_email , '90 '); ?> </div> <p><strong>Website:</strong> <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a><br /> <strong>Bio:</strong> <?php echo $curauth->user_description; ?></p> </div> <h2>Posts by <?php echo $curauth->nickname; ?>:</h2> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h3> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"> <?php the_title(); ?></a> </h3> <p class="posted-on">Posted on: <?php the_time('d M Y'); ?></p> <?php the_excerpt(); ?> <?php endwhile; // Previous/next page navigation. the_posts_pagination(); else: ?> <p><?php _e('No posts by this author.'); ?></p> <?php endif; ?>
¿Cómo podría implementarlo y darle algo de formato?
Gracias! 🙂
La página con la que necesito ayuda: [accede para ver el enlace]
Viendo 4 respuestas - de la 1 a la 4 (de un total de 4)
Viendo 4 respuestas - de la 1 a la 4 (de un total de 4)
- El debate ‘Editar página de resultados de autor’ está cerrado a nuevas respuestas.