Archived topic
Pagination in header
1 reply · Started by Raul on February 25, 2021
Viewing posts 1–2 of 2
Hi,
I am using the following code to display a simple star rating in the header close to author name:
// Autor Symbol
add_filter( 'generate_post_author_output', function( $output ) {
global $post;
$stars = '';
$average = ci_comment_rating_get_average_ratings( $post->ID );
for ( $i = 1; $i <= $average + 1; $i++ ) {
$width = intval( $i - $average > 0 ? 20 - ( ( $i - $average ) * 20 ) : 20 );
if ( 0 === $width ) {
continue;
}
$stars .= '<span style="overflow:hidden; width:' . $width . 'px" class="dashicons dashicons-star-filled"></span>';
if ( $i - $average > 0 ) {
$stars .= '<span style="overflow:hidden; position:relative; left:-' . $width .'px;" class="dashicons dashicons-star-empty"></span>';
}
}
$custom_content = '<span class="average-rating"> | Bewertung: ' . $average .' ' . $stars .'</span>';
$custom_content = $output . $custom_content ;
return $custom_content;
} );
I also want to display the pagenumbers from the current article because my article has more than one page. How can I implement it?
Hi there,
you can use wp_link_pages function - but it only works if it is within the loop - so calling it outside the content wont work
https://developer.wordpress.org/reference/functions/wp_link_pages/
This archived topic is closed to new replies.