WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
Solution to Make Yoast WordPress Seo Plugin Compatible with Buddypress (6 posts)

  1. codegene
    Member
    Posted 1 year ago #

    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/

  2. sevelina
    Member
    Posted 1 year ago #

    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

  3. Martin
    Member
    Posted 1 year ago #

    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?

  4. codegene
    Member
    Posted 1 year ago #

    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 );
    }
  5. Martin
    Member
    Posted 1 year ago #

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

    Have you seen this to still be the case?

  6. Nykess
    Member
    Posted 11 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic