Join our new community forum for support & discussion

Join Now

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?

    Aizen

    Hi Ihor,

    I added the code to the functions.php file as below:

    <?php
    // Exit if accessed directly.
    defined( 'ABSPATH' ) || exit;
    
    // Include the core HiveTheme class.
    require_once __DIR__ . '/includes/class-core.php';
    
    /**
     * Returns the core HiveTheme instance.
     *
     * @return HiveTheme\Core
     */
    function hivetheme() {
    	return HiveTheme\Core::instance();
    }
    
    // Initialize HiveTheme.
    hivetheme();
    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' => 'Beware Scammers are contacting our members offering paid account upgrades. We will never contact you for this!',
    								'order'   => 6,
    							],
    						],
    					],
    				],
    			]
    		);
    	}
    );
    
    Aizen

    The text doesn’t appear anywhere, if I leave the code long enough it eventually breaks the listing page.

    ihor developer

    I noticed that you added it to the ListingHive functions.php file, please use a child theme instead and you’ll be able to update HivePress and ListingHive without erasing these customizations. Child theme can be created with 1 click using this plugin https://wordpress.org/plugins/child-theme-generator/ Once you generate a child theme this plugin can be removed.

    If this issue remains you can send temporary WP access to support@hivepress.io and I’ll check it.

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