How to add comments to page with custom layout from the Layout Builder
-
Topic
-
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.
This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.
Tagged: Comments, custom layout
Hello,
A custom layout doesn’t have anything to do with the default page template and so there’s no way for this to work and display comments.
You may be able to create an element for the layout builder that you could then add into your custom layout using the Layout Builder API.
http://dev.themeblvd.com/tutorial/add-remove-builder-elements/
For example, possibly something like this may do the trick:
/** * Register comments element */ themeblvd_add_builder_element( 'my_comments', 'Comments', 'none', array(), 'my_display_comments' ); /** * Display comments element */ function my_display_comments( $id, $options, $location ) { comments_template(); }
I can force comments on pages, that works. Used the code
But as soon as I choose a custom layout, the comment field disappears. Is there anyway to force the comments on custom layout pages as well?