• Resolved WPExplorer

    (@wpexplorer)


    Looking at the class-page.php file I see that the plugin manually adds support for themes to add a “wrapper” around the $content. But there isn’t any way to hook into this to provide support for your plugin in a theme.

    Can you please add a before content and after content hook to make it easier for theme developers to support your plugin without having to contact you guys to manually add support?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author HivePress

    (@hivepress)

    Thanks for your feedback, we’ll add a hook or another solution for this. If adding a custom CSS class to the existing wrapper is enough please try using this code snippet:

    add_filter(
    	'hivepress/v1/blocks/page',
    	function( $args ) {
    		return hivepress()->helper->merge_arrays(
    			$args,
    			[
    				'attributes' => [
    					'class' => [ 'class-one', 'class-two' ],
    				],
    			]
    		);
    	}
    );
    Thread Starter WPExplorer

    (@wpexplorer)

    Hi,

    Thanks for the reply!

    The problem is that we include hooks in the default template files. This is what our page.php template file looks like for example: https://a.cl.ly/nOuRv2JN – so while we could insert classes to fix any potential layout issues, we can’t add default hooks so if anyone is inserting content to their site via one of their hooks it won’t display on the HivePress pages.

    If there was a before/after content hooks we could provide full integration on the theme side.

    Plus, it would allow people to insert extra content on their HivePress pages before/after the content if they wanted (such as advertisements for example) so it could be helpful not just for theme developers.

    Thank you!!

    Plugin Author HivePress

    (@hivepress)

    Thanks for the details, indeed there’s no easy way to insert custom HTML between the header/footer and the HivePress page wrapper, we’ll try to resolve this in the next update.

    Plugin Author HivePress

    (@hivepress)

    While testing I found out that it’s already possible with existing hooks, by inserting new blocks before and after the page blocks. Please try this snippet to add a custom class and custom content before/after the HivePress page content:

    add_filter(
    	'hivepress/v1/blocks/page',
    	function( $args ) {
    		return hivepress()->helper->merge_arrays(
    			$args,
    			[
    				'attributes' => [
    					'class' => [ 'custom-class' ],
    				],
    
    				'blocks'     => [
    					'before' => [
    						'type'    => 'content',
    						'content' => 'custom HTML before',
    						'_order'  => 1,
    					],
    
    					'after'  => [
    						'type'    => 'content',
    						'content' => 'custom HTML after',
    						'_order'  => 1000,
    					],
    				],
    			]
    		);
    	}
    );

    We’ll also add a new article to the docs with the most common theme integration issues.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Theme Integration’ is closed to new replies.