Join our new community forum for support & discussion
Join NowHome › Support › Themes › ListingHive › Hide Claim Listing Link
Hide Claim Listing Link
-
AuthorPosts
-
Cindabella 2 years ago
Hi ihor, I would like to hide the Claim Listing link on some of my categories and their sub-categories. Is this a future feature or can it be done with a CSS snippet.
Love your free theme and extensions, thank you. 🙂
Please try using this code snippet, replace “1,2,3” with category IDs:
add_filter( 'hivepress/v1/templates/listing_view_page/blocks', function( $blocks, $template ) { $listing = $template->get_context( 'listing' ); if ( $listing && array_intersect( $listing->get_categories__id(), [ 1, 2, 3 ] ) ) { $blocks = hivepress()->helper->merge_trees( [ 'blocks' => $blocks ], [ 'blocks' => [ 'listing_claim_submit_link' => [ 'type' => 'content', ], ], ] )['blocks']; } return $blocks; }, 1000, 2 );
You can add it via the Code Snippets plugin https://wordpress.org/plugins/code-snippets/
jaimevivesfilms 2 years agoHey @Cindabella,
I want to hide the Claim Listing button too. Did you achieve it by doing what @ihor said?
I added the code snippet on Snippet>Add New>and then pasted it under the “Code” tab, but the link didn’t hide.
Let me know if it worked for you please!
Thanks legends.
@jaimevivesfilms If you want to hide it globally you can simply disable the Claim Listings extension, but if you mean hiding it for some specific categories please make sure that you replaced “1,2,3” with the category IDs where you want it to be hidden.
Cindabella 2 years ago@ihor thank you it worked perfectly. 🙂
@jaimevivesfilms replace the 1, 2, 3 with the categories you don’t want to show it on. I used the plugin that @ihor suggested and works. Make sure you tick – add snippet everywhere. Good luck 🙂Cindabella 2 years ago@igor is it possible to hide the date as well? “ADDED ON MARCH 23, 2021”
@Cindabella please try using the CSS code snippet suggested in this topic – https://hivepress.io/support/topic/how-do-i-remove-the-date-from-the-listings/
Cindabella 2 years ago@serhill Thanks but that would remove the date on all listings.
I would prefer to remove the date on certain categories, is that possible?
Cindabella 2 years ago@serhii sorry not @serhill 🙂
In this case please try using the following code snippet instead:
add_filter( 'hivepress/v1/templates/listing_view_page/blocks', function( $blocks, $template ) { $listing = $template->get_context( 'listing' ); if ( $listing && array_intersect( $listing->get_categories__id(), [ 1, 2, 3 ] ) ) { $blocks = hivepress()->helper->merge_trees( [ 'blocks' => $blocks ], [ 'blocks' => [ 'listing_claim_submit_link' => [ 'type' => 'content', ], 'listing_created_date' => [ 'type' => 'content', ], ], ] )['blocks']; } return $blocks; }, 1000, 2 );
Cindabella 2 years agoUnfortunately that one didn’t work @ihor 🙁
What could I be doing wrong?Should work for the single listing pages, if you mean the listing search pages you can try using the same snippet but replace “listing_view_page” with “listing_view_block”.
Cindabella 2 years agoThanks. Understand now and it’s all working. 🙂
Hanna 11 months agoHi,
Can the claim listing link be hidden in all listings except in the ones made by admin? (So the claim listing link would be visible only in listings that are made by the admin)
Thanks!Please try this PHP snippet
add_filter( 'hivepress/v1/templates/listing_view_page/blocks', function($blocks, $template){ $listing = $template->get_context('listing'); if($listing && !user_can($listing->get_user__id(), 'manage_options')){ $blocks = hivepress()->helper->merge_trees( [ 'blocks' => $blocks ], [ 'blocks' => [ 'listing_claim_submit_link' => [ 'type' => 'content', ], ], ] )['blocks']; } return $blocks; }, 1000, 2 );
Hanna 11 months agoPerfect, this works! Thanks so much!
-
AuthorPosts
New Reply
This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.