Site logo

Archived topic

Disable entry-title link

7 replies · Started by Yerai on January 31, 2022

Viewing posts 1–8 of 8

Hello!

I'm building a directory using the directories pro plugin and Generate Press.

I've found only one issue that would ruin the site SEO and that is the entry-title element in location (custom taxonomy) pages has a link to the directory main page. I thought it was caused by the plugin itself, but the plugin developer told me it is a theme issue. So here I am hahaha.

My question is: Is there a way to disable that links for the entry-title class sitewide?

Thank you in advance! :)

Hi there,

can you share a link to a page where i can see the issue ? Then i can provide the correct solution

Hi David,

Thank you for your fast answer!

I share one url example with you. Sorry it is spanish and in development state, quite ugly.

Lets try this - create a new Layout Element ( in Appearance > Elements ):

https://docs.generatepress.com/article/layout-element-overview/

On the Disable Elements tab, check Content Title.
Then on the Display Rules you need to set the Location to the Archive that the Directory plugin is displaying. If the only posts you're displaying are from the Directory the you can use: All Archives

Hi David,

I just tried it but it makes the title vanish. I would like to remove only the link but not the title itself.

Is there a way to do that? (I hope so! hahaha)

Thanks again!

Oops my bad - obviously didn't read the title lol
So we can use the generate_get_the_title_parameters filter:

https://docs.generatepress.com/article/generate_get_the_title_parameters/

To remove the link you would use this snippet:

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;
} );

No worries David!

Thank you!!! It's solved! :D

Also you provided me that extra info that let me change the h2 tag to h1 tag. Awesome support!

Glad to be of help!

This archived topic is closed to new replies.