Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rewrite Author Name with Custom Fields

  • @myladeybugg

    Participant

    I am allowing guest posts on my main blog without the guests having to create users. I am trying to implement code that overrides the output of the_author using a custom field, but can’t seem to get it to work.

    When I looked in the bp-default single.php I did not see a call to the_author, maybe I missed it, but I’m thinking this could be the issue.

    Here is the code I am working with:
    `add_filter( ‘the_author’, ‘guest_author_name’ );
    add_filter( ‘get_the_author_display_name’, ‘guest_author_name’ );

    function guest_author_name( $name ) {
    global $post;

    $author = get_post_meta( $post->ID, ‘guest-author’, true );

    if ( $author )
    $name = $author;
    return $name;
    }`

    Any ideas on how to get it to work?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @myladeybugg

    Participant

    This code is hooking into: the_author and get_the_author_display_name

    It looks like buddypress uses: bp_core_get_userlink

    Anyone know how to use bp_core_get_userlink in the code above?

    @mercime

    Participant

    If you want to show all the posts by a given author/user, check out http://buddydev.com/plugins/buddyblog/

    @myladeybugg

    Participant

    @mercime Thanks for the suggestion, but I don’t think it’s exactly what I’m looking for.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Rewrite Author Name with Custom Fields’ is closed to new replies.
Skip to toolbar