Jan 20, 2022 12:29 pm
Is there a way when on the URLs such as:
/forum/recent/?view=no-replies
To change the page title tags from "Recent Posts" to something else to make it so they reflect page content better?
Obviously a filter or other method would do where I can check the $_GET var for "view" then use a switch case to decide what titles would be would be best as it lets me change this for all the various views available without editing plugin core.
2 Replies
Jan 20, 2022 1:27 pm
Hi @sc89me,
You can use the 'wpforo_seo_recent_posts_title' hook. The hook is located in /wp-content/plugins/wpforo/wpf-includes/wpf-hooks.php
elseif( $template == 'recent' ){
$wpfpaged = ( isset($_GET['wpfpaged']) && $_GET['wpfpaged'] > 1 ) ? ' - ' . wpforo_phrase( 'page', false) . ' ' . $_GET['wpfpaged'] .' ' : '';
$view = wpfval($_GET, 'view');
if( $view == 'unread'){
$main_title = wpforo_phrase( 'Unread Posts', false);
} elseif( $view == 'prefix' ){
$main_title = wpforo_phrase( 'Topic Prefix', false);
} else {
$main_title = wpforo_phrase( 'Recent Posts', false);
}
$meta_title = array( $main_title . $wpfpaged, WPF()->general_options['title']);
$meta_title = apply_filters('wpforo_seo_recent_posts_title', $meta_title);
}
Jan 20, 2022 2:29 pm
Thanks this is what I was looking for!