Notifications
Clear all

wpForo 1.x.x [Solved] Editing page meta title tag - Filter? Method?

3 Posts
2 Users
0 Reactions
1,156 Views
sc89me
Posts: 26
Topic starter
(@sc89me)
Eminent Member
Joined: 5 years ago

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
Robert
Posts: 10536
Admin
(@robert)
Support Team
Joined: 8 years ago

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);
}
sc89me
Posts: 26
Topic starter
(@sc89me)
Eminent Member
Joined: 5 years ago

Thanks this is what I was looking for!