Archived topic
Remove Page Title & Feature Image Link
5 replies · Started by Daniel on April 28, 2022
How can I remove Page Tille & Featured image URL homepage and on every archive page?
Hi there,
simplest approach would be to create your own template using a Block Element - Content Template:
https://docs.generatepress.com/article/block-element-content-template/
Then you can add dynamic title and featured images without the link.
If not then you will need some PHP like that provided in this doc:
https://docs.generatepress.com/article/generate_featured_image_output/#example
Ok, and how do I remove the Page Title URL from homepage and archive pages using this method: https://docs.generatepress.com/article/generate_featured_image_output/#example
1. Add this snippet to remove the H2 Title Link:
add_filter( 'generate_get_the_title_parameters', function( $params ) {
if ( ! is_singular() ) {
$params = array(
'before' => sprintf(
'<h2 class="entry-title"%1$s>',
'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
),
'after' => '</h2>',
);
}
return $params;
} );
2. Add the first snippet in that doc to remove the link for the featured image.
https://docs.generatepress.com/article/generate_featured_image_output/#example
And this doc explains how to add PHP: https://docs.generatepress.com/article/adding-php/
Thanks! It worked.
Glad to hear that!