Show Author on Listing Archive and Search results pages

This topic contains 3 replies, has 3 voices, and was last updated by  Paolo 8 years, 5 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #285367

    Roman
    Buyer
    Post count: 232

    Hi, I would like to show Author on Listing Archive and Search results pages.
    Is there a way to do it?

    Thanks.

    #285587

    Kor
    Moderator
    Post count: 16516

    Hi Roman,

    Could you try using the code below and see if it’s what you’re looking for? It should display an author link on the listings page. Add this code in via plugin https://wordpress.org/plugins/code-snippets/ OR by adding code in your theme functions.php .

    
    
    /***** CODE STARTS HERE *****/
    // Display listing author on listing pages.
    function geodirectory_author_link_on_listings_page( $post ) {
        if ( !empty( $post ) && !empty( $post->post_author ) && geodir_is_page( 'listing' ) ) {
            $author_link = get_author_posts_url( $post->post_author );
            $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true', 'stype' => $post->post_type ), false );
            
            echo '<div style="clear:both;" class="geodir_more_info geodir-author-link"><i class="fa fa-user"></i> <span>' . __( 'Author:', 'geodirectory' ) . '</span> <a href="' . $author_link . '">' . get_the_author() . '</a></div>';
        }
    }
    add_action( 'geodir_before_listing_post_excerpt', 'geodirectory_author_link_on_listings_page', 10, 1 );
    /***** CODE ENDS HERE *****/

    thanks!

    #285849

    Roman
    Buyer
    Post count: 232

    Thanks Kor, it has worked really well.
    Is there also a way to add the same Author Link to gd_popular_post_view widget?

    Thank you.

    #285986

    Paolo
    Site Admin
    Post count: 31211

    Hi Roman, try to remove this part:

    && geodir_is_page( 'listing' )

    from the function provided by Kor.

    Let us know,

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount