Inserting HivePress blocks into custom pages (without Gutenberg)

Hello.

I am creating some custom page templates, and need to insert the Hivepress blocks into said page templates. (Without Gutenberg).

How would I go about inserting the listing category block, or the hivepress login form with php.

Thank you

Shameless Bump any way to render these blocks/content?

Sorry for the delay. If you mean default (not template-specific) HivePress blocks, you can use shortcodes instead, for example:

[hivepress_listings]
[hivepress_user_login_form]
1 Like

That was pleasantly easy :slight_smile: thank you

I have a few more questions aswell.

  1. Is there a place where I can find all the shortcodes available? I can’t seem to find the one for the reviews. I’m trying this <?php echo do_shortcode('[hivepress_reviews]'); ?> , but is not working.

  2. How can I edit the different options of said block when adding it as a short code? Like how many rows, if I want the slider function on the review block etc. ?

  1. There’s no reference yet (shortcodes are used as a fallback for WP versions below 5.0), but any HivePress block you see in Gutenberg has a shortcode, it’s name is the block name with underscores and “hivepress” prefix. Settings are the same as the block settings. The reviews shortcode seems to be ok, make sure that there’s at least 1 review to show and that HivePress Reviews are installed.

  2. Sliders for reviews are available in some of our premium themes only, you can try adding this parameter to enable it:

slider="true"

Can’t seem to get the reviews shortcode to work. It works when I add is as a block, but I want to add it in php, because I am making custom page templates.

The shortcode name is based on the block name (lowercase with underscores), the block name is Reviews so it should be ok, please make sure that the editor where the shortcode is added processes shortcodes hivepress-reviews/class-reviews.php at master · hivepress/hivepress-reviews · GitHub

Not sure what you mean with editor processing shortcodes, other shortcodes works fine on the page, like echo do_shortcode(’[hivepress_listing_categories]’).

Also I do have reviews to display, because when I add the reviews block with the gutenberg blockeditor, everything seemes to work as expected. It’s the echo do_shortcode(’[hivepress_reviews]’) that doesnt work, but I can tell that it is the correct reference, because it doesn’t return a string of text, like it does when trying to call a misspelled shortcode.

Thanks for reporting this, the bug is confirmed, and we’ll fix it as soon as possible. As a temporary solution, please try to use Gutenberg blocks to paste listing reviews on the page.