Search bar/function

  • Author
    Posts
  • BrownC

    Hi ihor,

    How do I make it such that the search bar also displays on the final listing post page?

    It displays on the home page and listings page, but not the actual individual listing page.

    Thanks

    ihordeveloper

    This code snippet should do it (add it to the child theme’s functions.php file):

    add_filter(
    	'hivepress/v1/templates/listing_view_page',
    	function( $template ) {
    		return HivePress\Helpers\merge_trees(
    			$template,
    			[
    				'blocks' => [
    					'page_container' => [
    						'blocks' => [
    							'page_header' => [
    								'type'       => 'container',
    								'tag'        => 'header',
    								'_order'     => 5,
    
    								'attributes' => [
    									'class' => [ 'hp-page__header' ],
    								],
    
    								'blocks'     => [
    									'listing_search_form' => [
    										'type'   => 'listing_search_form',
    										'_order' => 10,
    									],
    								],
    							],
    						],
    					],
    				],
    			]
    		);
    	}
    );
    BrownC

    Hi ihor,

    Thanks for this.

    It says there is an error in line 31 of the code.

    BrownC

    Your PHP code changes were rolled back due to an error on line 31 of file wp-content/themes/Listchild/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘,’
    ——–
    This is what it says

    ihordeveloper

    Please make sure that you copied it correctly, I added the same code on a local installation and it seems to work https://prnt.sc/rmear6

Viewing 5 posts - 1 through 5 (of 5 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.