WordPress.org

Support

Support » Plugins and Hacks » Solution to Make Yoast WordPress Seo Plugin Compatible with Buddypress

Solution to Make Yoast WordPress Seo Plugin Compatible with Buddypress

  • Solution to Make Yoast WordPress Seo Compatible with Buddypress

    You will have to add the following code given below in class-frontend.php in frontend folder in yoast plugin.
    http://yoursite.com/wp-content/plugins/wordpress-seo/frontend/class-frontend.php

    In the line 395 i.e after the following code,

    if ( ( $modified_title && empty( $title ) ) || !empty( $title_part ) )
    $title = $this->get_default_title( $sep, $seplocation, $title_part );

    Add this code after the above mentioned code

    if (bp_is_group() or bp_is_group_forum() or bp_is_group_forum_topic() or bp_is_user() ){
    $title = (bp_is_group_forum_topic() ? bp_get_the_topic_title() . ' - ' : '')
    . bp_get_current_group_name() . bp_get_displayed_user_fullname() .' - '. $this->get_default_title( $sep, $seplocation, $title_part );
    }

    I have got it working for group, group forum post and member pages. You can modify it to support other buddypress component titles. I am using wordpress 3.5.1 and Buddypress 1.7.2

    To those who are having problems while modifying the code, just replace the whole code in your class-frontend.php with my class-frontend.php code – http://pastebin.com/85iKsiu4

    http://wordpress.org/extend/plugins/wordpress-seo/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thank you! good solution for the group and forum titles.
    I’ve changed a little bit:

    if (bp_is_group() or bp_is_group_forum() or bp_is_group_forum_topic() or bp_is_user() ){
    $title = (bp_is_group_forum_topic() ? bp_get_the_topic_title() . ' - ' : '')
    . bp_get_current_group_name() . bp_get_displayed_user_fullname() .' - '. $this->get_default_title( $seplocation, $title_part );
    }

    For members profile I prefer this http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-buddypress-integration?replies=17#post-4210383

    Martin
    Member

    @rastarr

    Wow, this is looking really great.
    I just tried it on my localhost and noticed when clicking into a Topic of a Forum in a Group (BuddyPress 1.7.2), I get this:

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title><br />
    <b>Fatal error</b>:  Call to undefined function bp_get_the_topic_title() in <b>/Users/MartinC/Sites/gaj/wp-content/plugins/wordpress-seo/frontend/class-frontend.php</b> on line <b>397</b><br />

    thoughts?

    bp_get_the_topic_title() is defined at /wp-content/plugins/buddypress/bp-forums/bp-forums-template.php at line 443. Check whether it is defined in the same way in your bp-forums-template.php. For example, earlier versions of buddypress used bp_is_member() for Members. Now it is replaced by bp_is_user. Also it will be better if you use bbpress plugin http://wordpress.org/plugins/bbpress/ for sitewide forums instead of buddypress group forums because buddypress groups forums is no longer available with buddypress 1.7.2. Only those who installed buddypress before it can continue to use it. They did it because bbpress site wide forums offers more features than one which was earlier included with buddypress. Also bbpress sitewide forums have good integration with Yoast WordPress SEO and Buddypress.

    If you use bbpress plugin for sitewide forums then you can use the code which I mentioned above in my previous post in the following way.

    if (bp_is_group() or bp_is_user() ){
    $title = bp_get_current_group_name() . bp_get_displayed_user_fullname() .' - '. $this->get_default_title( $sep, $seplocation, $title_part );
    }
    Martin
    Member

    @rastarr

    Hmm, I see the canonical URLs are still showing the base URL.

    Have you seen this to still be the case?

    I appreciate the code edits, but they don’t work with all of the newest versions. Any update?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Solution to Make Yoast WordPress Seo Plugin Compatible with Buddypress’ is closed to new replies.