Author Not Showing on Listing
This topic contains 12 replies, has 5 voices, and was last updated by TØm Babwá 11 years, 1 month ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
July 23, 2014 at 12:53 pm #9585
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?
July 23, 2014 at 1:58 pm #9591Is 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).
July 23, 2014 at 3:20 pm #9609Thanks 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 🙂
July 23, 2014 at 3:37 pm #9613I 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 🙂
July 23, 2014 at 4:03 pm #9616There you go, I still act “old school”, the John’s answer is the masterpiece 🙂
July 23, 2014 at 5:48 pm #9622Thanks 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?
July 23, 2014 at 6:11 pm #9624With 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>'; } ?>July 23, 2014 at 6:55 pm #9642John 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 😉
July 23, 2014 at 6:56 pm #9643The last message was my modifications to john’s code 😛
July 23, 2014 at 7:00 pm #9644We all knew that 😀
Thanks both, it’s greatly appreciated.
July 23, 2014 at 9:08 pm #9679Since 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.
July 24, 2014 at 1:26 pm #9757Thanks Guust, but I don’t want to use the claim manager. It’s really just another plugin that the site doesn’t really need.
September 20, 2014 at 7:37 pm #15990Nice trick !
Thank you Simone.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket