WordPress.org

Ready to get started?Download WordPress

Forums

Co-Authors Plus
The guest author function doesn't work everywhere.. (5 posts)

  1. DivaVocals
    Member
    Posted 11 months ago #

    It works fine on the admin side, but the front-end is not displaying the guest authors name as it should. The instructions for adding the guest author to my template are here. http://vip.wordpress.com/documentati...to-your-theme/.

    I added the suggested code to my custom-functions.php file
    Code:

    if ( function_exists( 'coauthors_posts_links' ) ) {
        coauthors_posts_links();
    } else {
    
        the_author_posts_link();
    
    }

    Nothing seemed to happen.. so then I tried this:

    Code:

    function guest_author_shortcode( $attr ) {
        $attr = shortcode_atts( array( 'before' => '', 'after' => '' ), $attr );
        if ( function_exists( 'coauthors_posts_links' ) ) {
            $author = coauthors_posts_links( null, null, null, null, false );
        } else {
            $author = '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author_meta( 'display_name' ) ) . '">' . get_the_author_meta( 'display_name' ) . '</a></span>';
        }
        return $attr['before'] . $author . $attr['after'];
    }

    This is the result..

    So here is the guest authors profile page:
    http: // eitestsite(dot)eyeitalia(dot)com/author/sonia-bieber/

    And you can see the one article she has written.. However, when you go to the direct link to the article: http: // eitestsite(dot)eyeitalia(dot)com/2013/08/15/experience-tuscany-from-the-decks-of-your-own-yacht/, you'll see that my name is listed as the author..

    I know I'm missing something, but honestly, I'm tired and confused, and since PHP is not my first (or second language) I'm not sure how to get this to work.. Could use a hand from the much wiser members of this community.. Can someone lend a lady a hand.. PRETTY PLEASE.. what the heck am I missing..

    http://wordpress.org/plugins/co-authors-plus/

  2. DivaVocals
    Member
    Posted 11 months ago #

    Well I couldn't get this to work so I've implemented a workaround until I can come back to this..

    To display the guest authors name in the guest posts, I've added a function to my theme's functions.php file so that using a custom field, my guest authors name will appear in place of the name of WordPress user who posted the article..

    This same function does something similar with the author link. I enter the author page link in a custom field. Since the Co-Authors Plus plugin creates an author page for my guest authors, I can use that as the author link URL in the custom field.

    So all together this is how this will work for me:
    I use Co-Authors Plus to create a guest author profile.. I grab the slug from my author profile. The slug will make up the author page URL (http://yoursite.com/author/author slug]/)

    Now I create my post, add the author's name and the author page URL to my custom fields, then change the post author to the author I added using Co-Authors Plus (so that this post will appear as a part of this authors postings), and it all works as I need it to..

    Yes I KNOW that this is more work. Had I been able to figure out how to configure Co-Authors Plus I wouldn't need to do this.. However I simply cannot figure out how to get the theme function to work.. Soooooooo... For now this is a usable workaround..

  3. Pablo @ vDevices
    Member
    Posted 11 months ago #

    Have you checked out Bill Erickson's solution? See Multiple Authors for a Post

  4. DivaVocals
    Member
    Posted 10 months ago #

    Nope.. (not to mention this is NOT using a Genesis template)but honestly my workaround is doing the trick.. the custom fields + the Co-Author's plugin guest author page is doing the trick for me..

  5. peter-a
    Member
    Posted 9 months ago #


Reply

You must log in to post.

About this Plugin

About this Topic