Tagged: x
-
AuthorPosts
-
May 24, 2016 at 3:57 am #1006829
helloengParticipantHi.
I found the following code on your forums.
1. code to make the author name a link to an author page
2. code to add the wordpress author profile at the top of the author pageBut when I look at the author page on my phone, the author picture is NOT shown. The same happens when I resize the screen on desktop, at a certain point the picture just disappears.
Do you have any ideas how to fix this?
Here is the php code for the functions.php file
functions.php
makes author name a link the that author’s page, with author’s previous articles// Entry Meta – Adding Author Link
// =============================================================================if ( ! function_exists( ‘x_renew_entry_meta’ ) ) :
function x_renew_entry_meta() {//
// Author.
//$author = sprintf( ‘<span>%2$s</span>’,
get_author_posts_url( get_the_author_meta( ‘ID’ ) ),
get_the_author()
);//
// Date.
//$date = sprintf( ‘<span><time class=”entry-date” datetime=”%1$s”>%2$s</time></span>’,
esc_attr( get_the_date( ‘c’ ) ),
esc_html( get_the_date( ‘F j, Y’ ) )
);//
// Categories.
//if ( get_post_type() == ‘x-portfolio’ ) {
if ( has_term( ”, ‘portfolio-category’, NULL ) ) {
$categories = get_the_terms( get_the_ID(), ‘portfolio-category’ );
$separator = ‘, ‘;
$categories_output = ”;
foreach ( $categories as $category ) {
$categories_output .= ‘<a href=”‘
. get_term_link( $category->slug, ‘portfolio-category’ )
. ‘” title=”‘
. esc_attr( sprintf( __( “View all posts in: “%s””, ‘__x__’ ), $category->name ) )
. ‘”> ‘
. $category->name
. ‘‘
. $separator;
}$categories_list = sprintf( ‘<span>%s</span>’,
trim( $categories_output, $separator )
);
} else {
$categories_list = ”;
}
} else {
$categories = get_the_category();
$separator = ‘, ‘;
$categories_output = ”;
foreach ( $categories as $category ) {
$categories_output .= ‘<a href=”‘
. get_category_link( $category->term_id )
. ‘” title=”‘
. esc_attr( sprintf( __( “View all posts in: “%s””, ‘__x__’ ), $category->name ) )
. ‘”>’
. $category->name
. ‘‘
. $separator;
}$categories_list = sprintf( ‘<span>%s</span>’,
trim( $categories_output, $separator )
);
}//
// Comments link.
//if ( comments_open() ) {
$title = apply_filters( ‘x_entry_meta_comments_title’, get_the_title() );
$link = apply_filters( ‘x_entry_meta_comments_link’, get_comments_link() );
$number = apply_filters( ‘x_entry_meta_comments_number’, get_comments_number() );if ( $number == 0 ) {
$text = __( ‘Leave a Comment’ , ‘__x__’ );
} else if ( $number == 1 ) {
$text = $number . ‘ ‘ . __( ‘Comment’ , ‘__x__’ );
} else {
$text = $number . ‘ ‘ . __( ‘Comments’ , ‘__x__’ );
}$comments = sprintf( ‘<span>%3$s</span>’,
esc_url( $link ),
esc_attr( sprintf( __( ‘Leave a comment on: “%s”’, ‘__x__’ ), $title ) ),
$text
);} else {
$comments = ”;
}
//
// Output.
//if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( ‘<p class=”p-meta”>%1$s%2$s%3$s%4$s</p>’,
$author,
$date,
$categories_list,
$comments
);
}}
endif;puts author bio (from user profile) at top of author page (above)
// Show Author Box on Author Page
// =============================================================================function add_author_meta() {
if ( is_author() ) {
$id = get_the_author_meta( ‘ID’ );
echo do_shortcode(‘[author id=”‘.$id.'”]’);
}
}add_action(‘x_before_view_global__index’, ‘add_author_meta’);
May 24, 2016 at 3:58 am #1006832
helloengParticipantThis reply has been marked as private.May 24, 2016 at 4:13 am #1006861
ChristopherModeratorHi there,
Please add following code in Customize -> Custom -> CSS :
@media (max-width: 480px){ .x-author-box .avatar { display: block; } }Hope it helps.
May 24, 2016 at 4:38 am #1006891
helloengParticipantBOOM! Fixed! You are the best, Christopher! Thanks so much 😉
May 24, 2016 at 5:26 am #1006950
ThaiModeratorYou’re most welcome 🙂
If you need anything else please let us know.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1006829 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
