BP – bbP – WordPress SEO integration
-
To all those smart coding guys out there, please can someone help me with the bbP functions needed to complete the code below. I think there are two bbP functions needed – see square brackets [??…]. Or maybe someone has a better way of doing it.
I’m trying to integrate BP1.6.1, the new bbP2.2.2 forums and WordPress SEO1.3.1.1 so that the WordPress SEO (meta) page titles are shown when a bbP Topic is being shown within a BP page (just like they are shown for native bbP forum pages).
I’ve hooked functions into ‘bp_modify_page_title’ before and managed to extract ‘_yoast_wpseo_title’ before. So I’m part way there I guess.
I also understand that I need to change the priority from 10 to 16 (or more) in line below (in buddypress>bp-core>bp-core-filters.php), to make bp_modify_page_title filter execute after, and hence overrule, WPSEO title which has priority 15 (in worpress-seo>frontend>class-frontend.php).
add_filter( ‘wp_title’, ‘bp_modify_page_title’, 16, 3 );
add_filter( 'bp_modify_page_title', 'new_page_title', 10, 4 );
function new_page_title( $new_page_title, $title, $sep, $seplocation ) {
global $bp, $bbp;
/** If bbP Topic is being shown within a BP page then replace title with title input via Yoast WordPress SEO plugin */
if ( [?? a bbp function that is true when bbP Topic is being shown within a BP page] && bp_is_active( 'groups' ) && !empty( $bp->groups->current_group ) ) {
[?? a bbp function that loads the bbP Topic Post ID to $topic->ID];
$new_page_title= get_post_meta( $topic->ID, _yoast_wpseo_title, true);
}
return $new_page_title;
}
If you can help please, and I can then get this to work, I’ll post the result back again so others can benefit.
Many thanks.
- You must be logged in to reply to this topic.