This topic has 7 replies, 5 voices, and was last updated 8 years by eric75.

  • Author
  • #90527
     lopreg
    Participant

    Hi,

    I am using the wordpress seo plugin on my site which I discovered doesn’t work well for titles on budypress pages. I used the code snippet below to fix the issue.

    COPY CODE
    // Fix wpseo title
    add_filter('wpseo_title', 'buddypress_wpseo_title');
    
    function buddypress_wpseo_title($title) {
        $wpseo = WPSEO_Frontend::get_instance();
        $separator = $wpseo->options['separator'];
    
        $separator_options = array(
            'sc-dash' => '-',
            'sc-ndash' => '–',
            'sc-mdash' => '—',
            'sc-middot' => '·',
            'sc-bull' => '•',
            'sc-star' => '*',
            'sc-smstar' => '⋆',
            'sc-pipe' => '|',
            'sc-tilde' => '~',
            'sc-laquo' => '«',
            'sc-raquo' => '»',
            'sc-lt' => '< ',
            'sc-gt' => '>',
        );
    
        if (array_key_exists($separator, $separator_options)) {
            $separator = $separator_options[$separator];
        }
        $bp = buddypress();
        if (bp_is_user()) {
            $title = bp_get_displayed_user_fullname() . ' | ' . ucfirst($bp->current_component);
        } elseif (bp_is_group()) {
            $title = bp_get_current_group_name() . ' | ' . $bp->bp_options_nav[$bp->groups->current_group->slug][bp_current_action()]['name'];
        }
    
        return $title . ' ' . $separator . ' ' . get_bloginfo();
    }

    However, certain pages on my site now show my site name twice on the titles as can be see here =>http://urlgone.com/301/25fd31/.
    How can this be fixed?
    I have looked at http://kb.yoast.com/article/76-the-seo-title-output-for-the-plugin-doesnt-work-as-expected but can’t find where to implement it on kleo. The Force a Rewrite option did not fix the issue

    #91011
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #91043
     lopreg
    Participant

    Thanks for the response @Laura. I think I solved the issue by editing some of WpSEOs title templates from the default %%title%% %%page%% %%sep%% %%sitename%% to just %%title%%. What I don’t know is if this will have any negative SEO effect in future.
    If there is a better way around this, I will love to know. Thanks again

    #107723
     touren
    Participant

    does for the double title post already exist a tweek?

    #107752
     rikbutterflyskull
    Participant

    i fixed the previous snippet for the double title:

    COPY CODE
    // Fix wpseo title
    add_filter('wpseo_title', 'buddypress_wpseo_title');
    function buddypress_wpseo_title($title) {
        $wpseo = WPSEO_Frontend::get_instance();
        $separator = $wpseo->options['separator'];
    
        $separator_options = array(
            'sc-dash' => '-',
            'sc-ndash' => '–',
            'sc-mdash' => '—',
            'sc-middot' => '·',
            'sc-bull' => '•',
            'sc-star' => '*',
            'sc-smstar' => '⋆',
            'sc-pipe' => '|',
            'sc-tilde' => '~',
            'sc-laquo' => '«',
            'sc-raquo' => '»',
            'sc-lt' => '< ',
            'sc-gt' => '>',
        );
    
        if (array_key_exists($separator, $separator_options)) {
            $separator = $separator_options[$separator];
        }
        $bp = buddypress();
        if (bp_is_user()) {
            return bp_get_displayed_user_fullname() . ' ' . $separator . ' ' . get_bloginfo();
        } elseif (bp_is_group()) {
            return bp_get_current_group_name() . ' ' . $separator . ' ' . get_bloginfo();
        }
        return $title;
    }

    Yoast SEO has know problems with buddypress.
    Another trick: https://bp-tricks.com/coding/making-buddypress-compatible-with-the-wordpress-seo-plugin-from-yoast/

    #107757
     touren
    Participant

    thank you!! this worked!

    Do you have a clue how I can get Buddypress activity posts in meta title more SEO friendly

    I would like to have an individual title and meta description for each activity post.
    How can I get an excerpt of the first 6 words of the activity post as title and also as meta description (in best case also the first 6 words comma separated as meta keywords)
    I refer to posts like this http://seventhqueen.com/themes/kleo/members/demo/activity/90874/ – in the title and meta should then appear “let see the the view”

    pls. can somebody help me to get this work!!

    #107791
     rikbutterflyskull
    Participant

    Use the BuddyPress Support or wordpress.stackexchange.com for this things. It’s not a easy task what you want to do

    #135763
     eric75
    Participant
Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?