Home Support General HivePress Customize Page with Listings

Customize Page with Listings

  • Author
    Posts
  • Aizen

    Hi Ihor,

    Can you or anyone in the community tell me how I edit the page that has the main listings?

    I am a wordpress newb I’m sorry to say. I went into wp admin > pages > all pages > edit page

    Then added the text I wanted to appear on the listing page – but it doesn’t appear anywhere on the page :-S

    Thanks for all your help and support.

    ihor developer

    Hi,

    When you select a page as a listings page in HivePress/Settings section then it’s content is replaced with the listings page layout. HivePress templates are set using blocks so it’s possible to add any content anywhere on a page, but at the moment it requires a code snippet (as soon as I integrate it with the visual WordPress editor it will be possible to edit any template without code changes). Please let me know where you want to add a custom text and I’ll post a code snippet.

    Aizen

    HI Ihor,

    Thanks – I would like to input some text on the main listing page, below the search bar but above the listings – it needs to be perfectly centered. Thank you

    ihor developer

    Please try adding this code to the child theme functions.php file:

    add_filter(
    	'hivepress/v1/templates/listings_view_page',
    	function( $template ) {
    		return HivePress\Helpers\merge_trees(
    			$template,
    			[
    				'blocks' => [
    					'page_header' => [
    						'blocks' => [
    							'page_header_content' => [
    								'type'    => 'content',
    								'content' => '<p style="text-align:center">custom text here</p>',
    								'order'   => 100,
    							],
    						],
    					],
    				],
    			]
    		);
    	}
    );
    Aizen

    Thank you for this. Really appreciated.

    What if I wanted to add some custom text to website.com/Account/listings? Could you please help me with the code for that? As I noticed the pages don’t actually exist anywhere either.

    Thank you in advance. Will make a donation again end of this month

    ihor developer

    Sure, this code snippet should work:

    add_filter(
    	'hivepress/v1/templates/listings_edit_page',
    	function( $template ) {
    		return HivePress\Helpers\merge_trees(
    			$template,
    			[
    				'blocks' => [
    					'page_content' => [
    						'blocks' => [
    							'custom_page_content' => [
    								'type'    => 'content',
    								'content' => 'any custom content here',
    								'order'   => 6,
    							],
    						],
    					],
    				],
    			]
    		);
    	}
    );

    I plan to integrate these templates with the visual WordPress editor so it’ll be possible to edit any layout without code changes.

    Aizen

    Hi Ihor,

    Sorry I wasn’t able to ge this to work either 🙁

    ihor developer

    This is strange, I tried adding the same code and it adds the content above the listings https://www.screencast.com/t/FXbB3httbqF Is there some error message when you add it?

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

You must be logged in to reply to this topic.

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.