Join our new community forum for support & discussion

Join Now

Home Support Themes RentalHive When Search Result Returns “Nothing Found”, Add A Form “Join Waitlist”

When Search Result Returns “Nothing Found”, Add A Form “Join Waitlist”

  • Author
    Posts
  • Jessie

    Hello,

    Can you provide code to customize the “Nothing Found” Page.

    I want to add a form where instead showing “Nothing Found” in the page search result, I want to add a form with the following fields:
    Title: “Join Waitlist”, Name, Phone Number, Zip Code(required), Email (required), and a submit button.

    After user click submit, the info will send to my email, or stored anywhere in the wordpress.

    Thank you!
    Jessie

    yevhen developer

    It is possible, but requires code customizations. If you’re familiar with WP customization basics or have a developer for custom work please try starting with this code snippet:

    add_filter(
    	'hivepress/v1/templates/listings_view_page/blocks',
    	function( $blocks, $template ) {
    		
    		if(!have_posts()){
    			$blocks = hivepress()->helper->merge_trees(
    					[ 'blocks' => $blocks ],
    					[
    						'blocks' => [
    						    	'page_content' => [
    									'blocks' => [
    										'custom_nothing_found_content' => [
    											'type' => 'content',
    											'content' => 'Your custom content',
    											'_order' => '10',
    										]
    									]
    						    	],
    					     	],
    				]
    				)['blocks'];
    		}
    		
    		return $blocks;
    	},
    	1000,
    	2
    );
    joelblack

    This is great, works perfectly. Had to change 10 to 20 to get it in the right place. Question, is there a way to add a gravity form to this? Would you use the shortcode gravity form gives you, do_shortcode( );, or any other way to get in it?

    joelblack

    I figured this out in case anyone ever wants to do the same thing. I just added the gravity form with do_shortcode like below:

    
    'content' => '<div class="not-found-but"><p>We are adding new experts and categories regularly.  If you didn\'t find exactly what you were looking for, leave your name and email to be notified about new experts and categories as they are added.</p><div class="not-found-but-form">'. do_shortcode( '[gravityform id="4" title="false" description="false" ajax="true"]' ) .'</div></div>', 
    
    ihor developer

    Thanks for sharing!

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

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.