Site logo

Archived topic

Home Page (list of latest post) - how to open post link in a new tab

5 replies · Started by Joyce on September 25, 2020

Viewing posts 1–6 of 6

Hi Team,

I display list of latest post in home page, how can I change post link to open in a new tab?

Thanks,
Joyce

Hi there,

Any chance you can link us to the site in question?

You can use the private information field.

Let me know :)

Thanks Leo

Any chance you are using GP 3.0 beta?
https://generatepress.com/generatepress-3-0-a-new-era/

If so we can use this filter:

add_filter( 'generate_get_the_title_parameters', function( $params ) {
    if ( ! is_singular() ) {
        $params = array(
	    'before' => sprintf(
	        '<h2 class="entry-title"%2$s><a href="%1$s" rel="bookmark" target="_blank">',
		esc_url( get_permalink() ),
		'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
	    ),
	    'after' => '</a></h2>',
	);
    }
    return $params;
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

If not then you would need this solution:
https://generatepress.com/forums/topic/force-open-all-wordpress-blog-posts-in-new-tab-target_blank/#post-612849

Using 3.0 would be the better solution :)

Thanks Leo.

I use generatepress-3.0.0-alpha.2 (purchased on 8/9/2020), by any chance I can upgrade to GP 3.0 beta

This archived topic is closed to new replies.