Changing the Name in the Add Listing Widget
This topic contains 8 replies, has 2 voices, and was last updated by Giri 9 years, 2 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: GD Loginbox widget
-
AuthorPosts
-
September 20, 2016 at 10:19 pm #270032
Hi there,
We are moving on to our next question. (Thanks for your patience.)
On our Login page (URL to be added privately), we have used the GD Loginbox widget. Once a user is logged in, they can create and/or edit a Listing or Event. The way we are using our default CPT is to give it one name for the Main Name and another name for the Singular Name. What the user sees when they look at the drop-down choice of what they want to create and/or edit is the Main Name of our default CPT. Is there any way to swap that out with our Singular Name? I will post the link to the page so you can see what I mean.
Thank you!
September 20, 2016 at 10:20 pm #270033This reply has been marked as private.September 21, 2016 at 4:27 pm #270548I hope you are talking about “Add Listing” dropdown links in “My Dashboard” widget.
Please use this code in functions.php file.
Thanks
function modify_geodir_dashboard_links($links) { $post_types_array = geodir_get_posttypes( 'array' ); //$post_types = geodir_get_posttypes(); $post_types = array('gd_place'); foreach ($post_types as $post_type) { $add_listing_page = geodir_get_addlisting_link($post_type); $name = $post_types_array[$post_type]['labels']['name']; $singular_name = $post_types_array[$post_type]['labels']['singular_name']; $links = str_replace('value="'.$add_listing_page.'">'.$name.'</option>', 'value="'.$add_listing_page.'">'.$singular_name.'</option>', $links); } return $links; } add_filter('geodir_dashboard_links', 'modify_geodir_dashboard_links');September 21, 2016 at 5:21 pm #270572Giri, that is perfect!
For the Edit Listing drop-down right below it, would I change where it says add_listing_page to edit_listing_page?
Thank you!
September 22, 2016 at 7:49 am #271011Hi Deb,
We don’t have any edit listing page link in “My Dashboard” widget. Could you explain why you need it?
Are you talking about “My Listings” dropdown?
September 22, 2016 at 1:57 pm #271164This reply has been marked as private.September 22, 2016 at 2:19 pm #271201Delete my old code and then Try this code.
function modify_geodir_dashboard_links($links) { if ( !is_user_logged_in() ) { return $links; } $post_types_array = geodir_get_posttypes( 'array' ); global $current_user; $post_types = geodir_get_posttypes(); //$post_types = array('gd_place'); $author_link = get_author_posts_url( $current_user->data->ID ); $author_link = geodir_getlink( $author_link, array( 'geodir_dashbord' => 'true' ), false ); foreach ($post_types as $post_type) { $add_listing_page = geodir_get_addlisting_link($post_type); $listing_link = geodir_getlink( $author_link, array( 'stype' => $post_type ), false ); $listing_link = apply_filters( 'geodir_dashboard_link_my_listing', $listing_link, $post_type, $current_user->ID ); $name = $post_types_array[$post_type]['labels']['name']; $singular_name = $post_types_array[$post_type]['labels']['singular_name']; $links = str_replace('value="'.$add_listing_page.'">'.$name.'</option>', 'value="'.$add_listing_page.'">'.$singular_name.'</option>', $links); $links = str_replace('value="'.$listing_link.'">'.$name.'</option>', 'value="'.$listing_link.'">'.$singular_name.'</option>', $links); } return $links; } add_filter('geodir_dashboard_links', 'modify_geodir_dashboard_links');September 22, 2016 at 6:59 pm #271334Giri, you are the BEST!
Thank you! 🙂
September 23, 2016 at 6:40 am #271668You are welcome
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket