Skip Navigation

[Gelöst] Post navigation and comments in content template using the block editor

This support ticket is created vor 3 Jahre, 1 Monat. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 7 Antworten, has 2 Stimmen.

Last updated by Christian Cox vor 3 Jahre, 1 Monat.

Assisted by: Christian Cox.

Author
Artikel
#1939315

Hi Support.

I am moving my site from elementor to toolset blocks. And I am working on the content template for blog posts.

In elementor there is a widget for the post navigation and comment section, which I use but no such thing exists in toolset blocks or in the build in wordpress blocks.

I am talking about the (previous-Next and the comments) as shown in this image.

hidden link

I could register some shortcodes with custom codes, but what would toolset recommend? After all post navigation and comments ar e usual found on the blog post layout, in WordPress.

Cheers

#1939805
link-format.png
add-field-popup.png
add-field-icon.png

I could register some shortcodes with custom codes, but what would toolset recommend? After all post navigation and comments ar e usual found on the blog post layout, in WordPress.
Hi, some themes include pagination links automatically in the theme template files. For example, the default Twenty Twenty One theme will display next and previous pagination links, as well as the comments form and latest comments, without the need for any additional blocks in the block editor template design. This is true for both custom post types and standard WP Posts.

If your site's theme does not automatically display these for text pagination links to the next or previous post, you can use the Toolset Fields and Text block to insert Views shortcodes that will generate links in the template. Insert the F&T block and click the icon above the editor to "Add Field or View" - see the orange icon in the F&T Block toolbar in the screenshot add-field-icon.png. A popup will appear and you can select "Post next link" or "Post previous link" to insert the desired pagination link, and specify the link text / formatting. See the screenshots add-field-popup.png and link-format.png here.

You could also insert the shortcodes manually in a text block, if you prefer a shortcode approach.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-previous-link

Content Templates hook into the_content to style the main post contents, but that typically does not include the comment form and latest comments. Most themes will display comments separately from the_content, and the form and latest comments will automatically appear if discussion is enabled for that particular post. Which theme are you using, out of curiosity? When you mention "blog" posts, are you referring to the standard WordPress Post type, or to a custom post type created by Toolset Types?

#1944241

Hello Christian.

Let me show you what I am trying to achieve.

hidden link

As you can see I am trying to create a post single content template with toolset blocks to replace my template for single posts created in elementor.

And in elementor I have a widget that will display the post navigation related to the current post.
Yes Kadence theme has an option to show it if I use their page layout, but I am not because I want to control it in my content template (like full site editing)

Ideally I would like to show the post navigation as.

<- Previous 100% width if no next post exists
Next --> 100% width if no previous post exists
<--Previous (50% width) | Next (50% width) -> if both previous and next posts exists.

And yes I can create 3 rows, with conditions where I test if the previous / next fields returns a value, but it will mean that at least 6 queries will be added to the database, instead of one.

So performance wise I think it would be better if there was a block for it like elementor has. I dont know if the FSE in wordpress will include a post navigation block?

And yes I have created a shortcode that inserts the comment section. Elementor has a widget for that, but it does not exist in any block plugins. BUT I know for sure that the comment block will be part of the FSE in WordPress 5.8.

Finally. As you can see in the video, if you insert a Text / Field block and the shortcode returns an empty string. It would be nice with some kind of placeholder value so you could see that there is actually content in the row, so you get a better editing expierence using blocks.

Cheers.

#1947569

Okay thank you for the additional details about what you want to achieve. Here's what I can do.
- I can submit a feature request for adding a post navigation block that allows you to specify a design for the following:
--- The next block when only a next block is needed
--- The previous block when only a previous block is needed
--- Both next and previous blocks when both are needed
- I can submit a feature request for adding a comments block
- I have already submitted a consistency review for displaying various blocks that produce no output. Right now, the system is a bit inconsistent when displaying blocks with dynamic sources that produce no output in the current template context. It would be nice to be able to see some consistency here with placeholders that describe the missing output in a consistent way. Some empty dynamic sources display a text message, other display the field inputs, and others display nothing as you see here in this particular case. Our developers have acknowledged this inconsistency and will review the possibilities for enhancing empty dynamic sources in the block editor in a future release of the software.

I'll get some feedback from my 2nd tier support team about the feature requests and give you an update as soon as I can.

#1947705

Thank you. That is awesome. And for the record, I fully understand that its a balance until we get Full Site Editing.

Cheers.

#1947795

Hmm Can you get the raw url of the previous / next shortcakes, so you can use that for dynamic values in other blocks?

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-554769

The docs does not mention that?

#1947977

Can you get the raw url of the previous / next shortcakes, so you can use that for dynamic values in other blocks?
No, unfortunately there is no shortcode available for retrieving the raw URL or raw ID of the next or previous post, only an HTML link to a post. You could get the raw URL in a View, but a custom shortcode using get_adjacent_post and get_permalink would be more efficient here.

#1951701

I have some feedback from our 2nd tier support team. Since we have offered pagination shortcodes in the past, it makes sense that we would also offer pagination as a block, so we have submitted a feature request for adding the pagination block we discussed here. However, comments have been added by the theme in the past, and adding a comments block will be redundant when full site editing is available in WordPress. So we most likely won't be adding a redundant comment block.

I've connected this ticket to our internal feature request for a pagination block, so I'll keep you updated here as that ticket progresses. For comments, I think a custom shortcode implementation makes the most sense right now until full site editing is possible in an upcoming WordPress release.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.