Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

How can I add a rel=”me” attribute to an xprofile field? (19 posts)

Started 10 months, 4 weeks ago by: gregfielding

  • Profile picture of gregfielding gregfielding said 10 months, 4 weeks ago:

    Playing more with the google author code, it is definitely good for SEO to have a google profile xprofile field, with a rel=”me” attribute.

    Any ideas on how to assign this?

    Thanks!

  • Profile picture of enderandrew enderandrew said 10 months, 4 weeks ago:

    I’d be very interested in this as well.

  • Profile picture of gregfielding gregfielding said 10 months, 3 weeks ago:

    Here’s an article by Yoast where we explains how to add rel=”me” to standard WP profiles. Any thoughts on how we could incorporate this into BP Profiles?

    I’m assuming it could be as simple as a short snip of code that adds the attribute to the profile field, but maybe it’s more complicated…

  • Profile picture of gregfielding gregfielding said 10 months, 3 weeks ago:

    Here’s the article… http://yoast.com/wordpress-rel-author-rel-me

  • Profile picture of gregfielding gregfielding said 10 months, 3 weeks ago:

    The politest of bumps…

  • Profile picture of gregfielding gregfielding said 10 months, 2 weeks ago:

    @boonebgorges
    Any chance this could be added to Custom Profile Filters?

  • Profile picture of Paul Gibbs Paul Gibbs said 10 months, 2 weeks ago:

    Yeah, this isn’t super easy to do with regards to UI. Adding this type of microformat markup to core is something I would personally like to see in BP 1.4.

  • Profile picture of gregfielding gregfielding said 10 months, 2 weeks ago:

    @djpaul
    For now, I’m not worried about the user interface. Hardcoding it in somewhere would be ample.

    This will be big for SEO.

  • Profile picture of gregfielding gregfielding said 10 months, 2 weeks ago:
    //relme
    function relme ($output) {
            global $bp;
       if ( bp_field_has_data( '782' ) ) {
    	return str_replace('<a ','<a rel="me" ',$output);
     }
    }
    add_filter('xprofile_screen_display_profile', 'relme');

    I’m doing my best to hack my way through this. Here’s what I have – it doesn’t work, but it also doesn’t break the site.

    Field #782 is my Google Profile ID field.

  • Profile picture of Hugo Hugo said 10 months, 2 weeks ago:

    Try adding it with jQuery

  • Profile picture of Paul Gibbs Paul Gibbs said 10 months, 2 weeks ago:

    hnla: No, that’s not a good idea because Google will ignore it with jQuery.

    Greg: I agree hardcoding it is a good idea, but I always have core in mind when I read this sort of discussion :) xprofile_screen_display_profile is an action, not a filter. I assume you’re trying to change the value of an xprofiel field. ‘bp_get_the_profile_field_value’ is probably the filter you want.

    function gf_relme($value, $type, $id) {
      if (782 == $id) {
        return str_replace('<a ','<a rel="me" ',$value);
      }
    }
    add_filter('bp_get_the_profile_field_value', 'gf_relme', 10, 3);
  • Profile picture of gregfielding gregfielding said 10 months, 2 weeks ago:

    @djpaul
    That did the trick of adding rel=”me” – but now none of the other profile fields show.

    See: http://housingstorm.com/gregfielding/profile/

  • Profile picture of Paul Gibbs Paul Gibbs said 10 months, 2 weeks ago:

    oh, doh. put an

    else { return $value; }

    after the if closing bracket.

    While we’re talking about rel=me, what’s your opinion on if I add rel=”me” on the field(s) in BP-Default for BP 1.3? Bear in mind all the different member sub profile pages etc.

  • Profile picture of gregfielding gregfielding said 10 months, 2 weeks ago:

    Thanks Paul – that works great.

    You mean on all fields? I don’t think it would hurt anything…

  • Profile picture of Paul Gibbs Paul Gibbs said 10 months, 2 weeks ago:

    Sorry, on these ones: http://i55.tinypic.com/1qk977.png