How to create View shortcode?

You can create a View shortcode to display your posts, pages, custom post types in a beautiful grid/list layout.

To start, in the left menu of your Admin dashboard, click on Content Views >> Add View.

In the View page, please follow 3 simple steps below:

– Step 1 : in Filter Settings tab, filter your desired content (post, page, product, etc.) by ID, category, tag, author, keyword…

– Step 2 : in Display Settings tab, select one from many beautiful layouts to display your content. You can customize the layout with many useful settings.

– Step 3 : Save the View, then paste the generated shortcode [pt_view id="UNIQUE_ID"] to anywhere you want to display your grid/list (Classic editor, Gutenberg editor, Text widget…).
You also can add this code <?php echo do_shortcode('[pt_view id="UNIQUE_ID"]'); ?> to theme files.

Notices:

  • Please DO NOT wrap the View shortcode inside <pre></pre> tag like this
    <pre>[pt_view id="UNIQUE_ID"]</pre>.
  • To add our shortcode to the Block editor (Gutenberg), please check this document.

This is the video demonstrates 3 above steps:

Thank you,

Scroll to Top