Author Not Showing on Listing

This topic contains 12 replies, has 5 voices, and was last updated by  TØm Babwá 9 years, 7 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #9585

    migs
    Free User
    Post count: 42

    When a listing is added, it doesn’t show who added it anywhere on the detail page.

    Is this correct, or am I missing something?

    #9591

    Simone
    Expired Member
    Post count: 3515

    Is it correct, in the detail page it isn’t showing the author.
    You can tweak it by adding this

    
    
    <br>Listed by <?php the_author(); ?><br>
    

    where you want, in the template.
    Try to add it at the row 355 of the geodirectory_template_actions.php in wp-content/plugins/geodirectory
    right after

    
    
    <p class="geodir_post_taxomomies clearfix">  
    

    It will place the author above the Place categories (below the slideshow).

    #9609

    migs
    Free User
    Post count: 42

    Thanks Simone, that works beautifully!

    Is there any way to use the display name as a link to the user id profile page?

    The listings are but one part of a much larger site, and each user has a custom profile page that I’d like to be able to send other users to if they click the author’s name.

    I’m assuming that the_author pulls the name from the user id anyway?

    Excuse my lack of knowledge, I’ve found trying to learn this stuff like trying to learn Japanese :/

    Either way, I’m pleased with at least being able to display the name 🙂

    #9613

    John Allsopp
    Expired Member
    Post count: 399

    I would add this as a function, so that it doesn’t get overwritten by theme updates. Add this to your child theme’s functions.php

    
    
    add_action( 'geodir_details_main_content', 'my_show_author_mod', 45 );
    function my_show_author_mod() {
    	$myauthor = get_the_author();
    	$myauthorlink = get_author_posts_url( get_the_author_meta( 'ID' ) );
    	echo '<p class="clearfix">Listed by <a href="' .$myauthorlink . '">' . $myauthor . '</a></p>';
    }
    

    Hope that is ok for you 🙂

    #9616

    Simone
    Expired Member
    Post count: 3515

    There you go, I still act “old school”, the John’s answer is the masterpiece 🙂

    #9622

    migs
    Free User
    Post count: 42

    Thanks both, for your efforts.

    As regards John’s answer, it works as I’m sure it was intended to, but has with a link to the author page, which isn’t used on the site.

    Is there any way to link it to the author’s wp profile?

    #9624

    Simone
    Expired Member
    Post count: 3515

    With this you can see all the places for the given CPT

    
    
    add_action( 'geodir_details_main_content', 'my_show_author_mod', 45 );
    function my_show_author_mod() {
    global $post; 
    
    $current_posttype = geodir_get_current_posttype();
    
    	$myauthor = get_the_author();
    	$myauthorlink = get_author_posts_url( get_the_author_meta( 'ID' ) ).'?post_type='.$current_posttype;
    	echo '<p class="clearfix">Listed by <a href="' .$myauthorlink . '">' . $myauthor . '</a></p>';
    }
    ?>
    #9642

    migs
    Free User
    Post count: 42

    John that’s fantastic!

    Although it’s a little different to what I wanted, it’ll do just fine 🙂

    Simone, I hope you learned something here 😉

    #9643

    Simone
    Expired Member
    Post count: 3515

    The last message was my modifications to john’s code 😛

    #9644

    migs
    Free User
    Post count: 42

    We all knew that 😀

    Thanks both, it’s greatly appreciated.

    #9679

    Guust
    Moderator
    Post count: 29970

    Since we are all having a go here, I would just have done this 🙂 :

    WP admin > GD > Listings Claim > Show link to author page on listings? > YES

    That will only show the author if the listing is verified.

    #9757

    migs
    Free User
    Post count: 42

    Thanks Guust, but I don’t want to use the claim manager. It’s really just another plugin that the site doesn’t really need.

    #15990

    TØm Babwá
    Buyer
    Post count: 42

    Nice trick !

    Thank you Simone.

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

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

Open Support Ticket