Archived topic
Remove links from author and date entry meta/byline
6 replies · Started by 24xstudio on June 22, 2019
Hey,
I have been trying to remove links from the author name and date of entry meta/byline but non of your code works for me.
I have also tried these codes:
To remove it from the date, this should help: https://docs.generatepress.com/article/generate_post_date_output/#remove-link-from-date
For the author: https://docs.generatepress.com/article/generate_post_author_output/#remove-link
The current code I am using for the byline is:
if ( ! function_exists( 'generate_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function generate_posted_on()
{
$date = apply_filters( 'generate_post_date', true );
$author = apply_filters( 'generate_post_author', true );
//if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) )
$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
// If our date is enabled, show it
if ( $date ) :
printf( '<span style="float: left; margin-right: 3px;">Updated:</span><span class="posted-on">%1$s</span>',
sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
$time_string
)
);
endif;
// If our author is enabled, show it
if ( $author ) :
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>',
__( 'by','generatepress'),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
endif;
}
endif;
BUMP
Hi there,
Can you tell me what the current code is for?
We should be able to use filters now.
Let me know :)
The current code is for this: http://prntscr.com/o5frw4
Hmm shouldn't need that function at all now.
Remove that function and add the CSS here:
https://docs.generatepress.com/article/show-the-updated-post-date/
plus this for the separator:
.byline:before {
content: "| ";
}
Then the filters in the doc pages should work to remove the links.
Let me know :)
Thanks for the codes but I after applying the codes it looks like this: http://prntscr.com/o5hwwb
Can you link us to your site?