How to add og:title and og:description meta tags for Facebook on BuddyPress.
-
Since Yoast SEO plugin does not work on BuddyPress pages, I had to ask you guys this question, How can i add og:title and og:description meta tags for Facebook on BuddyPress pages?
-
Does this allow to add og:title and og:description meta tags? @venutius
bump
Why dn’t you try it and see, it’s the only og plugin I know for BP, so I would have thought it would, or if it didn’t you should ask the author to add the feature.
Hello,
The plugin only adds the og:image meta tag, it does not work for the description, and title.
Anyone know any more possible solutions?
Regards,
Liutauras V.
ExplosiveBeast TeamSeems like the plugin is abandoned too, which is a shame, it’s not been out that long. One option would be to for this plugin and add the features yourself I suppose?
@venutius I have been trying, but could not find where to add the meta tag. I can’t read the code. Could you help me with that? 🙂
I don’t think it would be a quick fix; 2000+ lines of code in the index alone, but I did notice it seems to have support for the description.
og:Title is in there too.
There’s different ways of solving it, you can look to this old post for some pointers.
or you could do something like this
<?php function opengraph_tags() { // defaults $title = get_bloginfo('title'); $excerpt = get_bloginfo('description'); if( bp_current_component() ) { global $post; setup_postdata( $post); $title = get_the_title(); $excerpt = get_the_excerpt(); if ($excerpt) { $excerpt = strip_tags($excerpt); $excerpt = str_replace("", "'", $excerpt); } } ?> <meta name="description" content="<?php echo $excerpt; ?>"/> <!-- general meta tag --> <meta property="og:title" content="<?php echo $title; ?>"/> <!-- facebook meta tag --> <meta property="og:description" content="<?php echo $excerpt; ?>"/> <!-- facebook meta tag --> <meta name="twitter:title" content="<?php echo $title; ?>"> <!-- twitter meta tag --> <meta name="twitter:description" content="<?php echo $excerpt; ?>"> <!-- twitter meta tag --> <?php } add_action('wp_head', 'opengraph_tags', 5);
You’d then be able to write the description of the buddypress page in the excerpt input while editing whatever Buddypress page. This only solves the main pages though.
If you’d like to go further for group, member and activity SEO you’d have to follow it up with some more code.
Hey @jonaskjodt,
Thank you very much for your response.
I have tried your code inserting into functions.php of my child theme and it did not work. I Don’t mean to sound like someone who wants everyone else does the job for him, but I really tried, and like I have said I can’t read the code, I have a really limited budget so I try to do as much work as I can my self. Unfortunately, I tried your code a couple times and I couldn’t get it to work, If there any more solutions, or a way of troubleshooting it?
Thank you again for helping me 🙂
- You must be logged in to reply to this topic.