Free Directory, Listing & Classifieds WordPress Plugin Support Themes ListingHive Hide ‘reply to listing’ function for certain listings

Hide ‘reply to listing’ function for certain listings

  • Author
    Posts
  • BrownC

    Hi ihor,

    Is it possible to Hide ‘reply to listing’ function for certain listings that have not been claimed and keep it on for those that have?

    ihordeveloper

    It’s not possible in the current version, but may be implemented. Please let me know what’s a use-case for this, if I understand correctly when the listing is not claimed then there’re no owners who can reply to messages?

    BrownC

    Yes, that’s correct.

    So i have some listings that have not been claimed and customers are messaging with no response.

    Alternatively is there a badge or way to show on the front-end that a listing has been claimed? Similar to the verified tick?

    ihordeveloper

    When you approve a claim, the “verified” status should be set automatically. This status is also used to check if the listing can be claimed.

    BrownC

    Is there a way to create a different badge for claimed listings that differentiates from verified?

    On my directory I have differentiated ‘verified’ as businesses that have submitted their local trade registration number/certificates and ‘claimed’ listings are simply those which businesses owners have claimed and are now moderating

    ihordeveloper

    I suggest using a custom checkbox attribute for this purpose, because the built-in “verified” attribute is used by extensions. I can provide a code snippet for displaying a custom attribute in the same way (next to the listing title), or you can assign it to some display area so there will be something like “Verified: Yes/No”.

    BrownC

    Thank ihor,

    The code snippet would be great!!

    ihordeveloper

    This one should do it, please replace “attributename” with the slug of the custom checkbox attribute you added (it should be lowercase and with underscores instead of spaces):

    add_filter( 'hivepress/v1/templates/listing_view_block/blocks', 'add_custom_verified_badge', 10, 2 );
    add_filter( 'hivepress/v1/templates/listing_view_page/blocks', 'add_custom_verified_badge', 10, 2 );
    
    function add_custom_verified_badge( $blocks, $template ) {
    	$listing = $template->get_context( 'listing' );
    
    	if ( $listing && $listing->is_attributename() ) {
    		$blocks = hivepress()->helper->merge_trees(
    			[ 'blocks' => $blocks ],
    			[
    				'blocks' => [
    					'listing_title' => [
    						'blocks' => [
    							'attributename' => [
    								'type'    => 'content',
    								'content' => '<i class="hp-listing__verified-badge hp-icon fas fa-check-circle" title="Custom title here"></i>',
    								'_order'  => 100,
    							],
    						],
    					],
    				],
    			]
    		)['blocks'];
    	}
    
    	return $blocks;
    }

    You can also change the icon by replacing the “check-circle” with another icon name https://fontawesome.com/icons?d=gallery&m=free

    BrownC

    Thanks so much.

    I’m just not sure how to add it as an attribute and assign it to certain posts. Right now you can only assisgn attributes to categories.

    Do I create an attribute called ‘claimed’ and add this to ‘format’ section of the attribute form. Or do I paste this to the snippet plugin? But then how do I link the snippet to the attribute?

    ihordeveloper

    Please try using an attribute for your custom verification, because the built-in “Verified” attribute is used for listing claims. You can add this snippet to the Code Snippets plugin (or a child theme functions.php), and just add a custom checkbox attribute. If you don’t make it editable on the front-end, then you’ll be able to mark listings on the back-end, and a custom badge will appear for these listings. The only change required is replacing “attributename” with the slug of the custom checkbox attribute, you can check if it works and displays an additional badge next to the listing title.

    ihordeveloper

    Also, you can use a custom attribute without any code snippets, e.g. by adding it to some display area, so it will display something like “Certificate: Yes/No”.

    BrownC

    Hi ihor,

    I tried my best to figure this out but i’m still struggling.

    My challenge is how to connect the snippet to the custom attribute.

    Here are the steps I’ve taken.

    1) Add the snippet to snippet code plugin-> edited slug to say ‘claim listing’
    2) Navigate to ‘Hivepress’-> Attributes-> Added attribute called ‘claimed listings’ as a checkbox function

    But now how do I connect the snippet and attribute? This is the step I’m missing.

    – Thanks again

    ihordeveloper

    If you named attribute “claim listing” then its slug is “claim_listing” (lowercase and underscores instead of spaces), please try using it in the code snippet. Then if you check this attribute for some listing a custom badge should appear.

    issab

    And what’s the code for adding a Whatsapp badge?

    issab

    I have inserted the code but I have the issues on the changing the badge part, for check circle. How should I put it to show the Whatsapp icon?

Viewing 15 posts - 1 through 15 (of 24 total)

You must be logged in to reply to this topic.

Subscribe

Sign In

Don't have an account? Register

Forgot password?

Register

Already have an account? Sign In

Forgot password?

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.