Home › Toolset Professional Support › [Resolved] Structure of Post Types/Taxonomies, can't preview post based on content template
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.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 7 replies, has 2 voices.
Last updated by Nigel 6 years, 1 month ago.
Assisted by: Nigel.
Tell us what you are trying to do?
This is my first time building custom post types with toolset. I'm not sure my structure is correct. I need to display Safety classes (and eventually will need Corporate Training classes) both offered by Business & Industry (BIS).
I've created the Post type for Safety Courses, as well as the fields and taxonomy, template, etc.
Would it be better to create the post type BIS Courses and add two taxonomies (Safety Courses and Corporate Training)?
Also, I am trying to build and style the single page template but need to be able to see it rendered with real content. I do have a post with the content template applied to it, but I'm unable to preview this post. I know I'm missing something...
Please see the attached pictures.
Is there any documentation that you are following?
Your site :
https://toolset.com/documentation/user-guides/view-templates/
https://toolset.com/documentation/user-guides/create-custom-taxonomies/
What is the link to your site? tulsatech.edu
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Elizabeth
Because you have created custom post types for Safety Courses and Corporate Training, I don't think it makes sense to also make taxonomies of the same to connect to the BIS Courses post type.
You might instead use post relationships. It sounds like BIS Courses would be the parent of Safety Courses and Corporate Training (two separate one-to-many relationships). See https://toolset.com/documentation/post-relationships/
As for previewing Content Templates as you create them, that is not available.
If you have a sample post to work with, from its post edit screen you can assign the Content Template you are working on, then visit the post on the front end.
Now in another browser tab edit the Content Template and make changes. Refresh the other tab to see those changes on the front end.
That's the closest you can come to a live preview.
Because you have created custom post types for Safety Courses and Corporate Training, I don't think it makes sense to also make taxonomies of the same to connect to the BIS Courses post type.
Actually, I was trying to determine the best method to implement this, not trying to do both at the same time. Sorry if I wasn't clear. Also, I was confusing categories with taxonomies.
After thinking it though again today, I've decided to create one post type, BIS Services, with one taxonomy, BIS Services Types. Under that, I've defined the Safety and Corporate categories, with further child categories to come for each. Would you agree that is an acceptable way to structure the posts?
You might instead use post relationships. It sounds like BIS Courses would be the parent of Safety Courses and Corporate Training (two separate one-to-many relationships). See https://toolset.com/documentation/post-relationships/
I'm leaving relationships alone for the moment as I think the single taxonomy under a single post type gives me what I need.
Can I have different Content templates defined for different categories?
As for previewing Content Templates as you create them, that is not available.
If you have a sample post to work with, from its post edit screen you can assign the Content Template you are working on, then visit the post on the front end. Now in another browser tab edit the Content Template and make changes. Refresh the other tab to see those changes on the front end. That's the closest you can come to a live preview.
Thanks, but I wasn't expecting to "live preview" the template directly. Instead, I was trying to view a post that was using the template just exactly as you described.
The issue, though, was that although I had published the post, there was no way to view that post from the front end. I have no "Preview" button in the Publish block, no "Preview post or View post" link in the alert at the top after a save, no permalink, and the "View BIS Service" button in the top black bar takes me to the homepage, rather that the published post: hidden link. Please see pics.
Have I missed a step somewhere? Why can't I see the published post from the front end?
Thanks again for your help.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Elizabeth
"Can I have different Content templates defined for different categories?"
Templates for individual posts are based upon post type. You can use conditional shortcodes to display different content for different categories (https://toolset.com/documentation/user-guides/conditional-html-output-in-views/).
You can create different templates for different taxonomy archives (which show lists of posts that have a particular term assigned). But not for different terms of the same taxonomy. So you would need to split safety and corporate into separate taxonomies for that.
Regarding the problem with the display of preview buttons and permalinks etc., the preview button appears on your first screenshot because your posts are private rather than published.
But the post updated message and admin toolbar links are generated by WordPress, and why the admin link takes you to the homepage, for example, is a mystery.
Can I take a look?
Let me mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, even though I don't intend to make any changes, except I may need to temporarily add a backup plugin to take a snapshot of the site.
Hi Nigel,
Thanks for your reply.
I'm sorry, but we have legal requirements that prevent us from granting access to the site. Is it possible to do a screen share with you?
Thanks,
Elizabeth
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Elizabeth
That's not something we offer, so let me see if I can guide you through some of the debugging steps I would be doing anyway.
First, we need to eliminate possible conflicts.
That means disabling all non-Toolset plugins and switching theme to twentyseventeen.
Do you still see the issue? If not, you should be able to determine the source of a conflict by a process of elimination.
If you do still see the issue on this pared down version of the site, check the browser console for JS errors, and check your debug log for PHP errors.
If you haven't already, turn on the debug log by editing your wp-config.php file and change the line with WP_DEBUG like so:
define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
That will create a debug.log file in your /wp-content/ directory which you can examine in any text editor. Try visiting the same page where you observe the problem and then inspect the log. If you don't find the debug.log file it means it didn't generate any warnings or errors.
Let me know what you find.
Hi Nigel,
I created a local copy of the site, and followed your instructions to deactivate plugins and change the theme. The issue still persisted, so below is the debug information from the local site:
[17-Dec-2018 15:58:42 UTC] PHP Fatal error: Class 'WP_CLI\SynopsisValidator' not found in <em><u>hidden link</u></em> on line 254 [17-Dec-2018 15:58:42 UTC] PHP Stack trace: [17-Dec-2018 15:58:42 UTC] PHP 1. {main}() /usr/local/bin/wp:0 [17-Dec-2018 15:58:42 UTC] PHP 2. include() /usr/local/bin/wp:4 [17-Dec-2018 15:58:42 UTC] PHP 3. include() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 4. WP_CLI\bootstrap() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 6. WP_CLI\Runner->start() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 7. WP_CLI\Runner->_run_command() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 8. WP_CLI\Runner->run_command() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 9. WP_CLI\Dispatcher\Subcommand->invoke() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 10. WP_CLI\Dispatcher\Subcommand->validate_args() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP Fatal error: Class 'WP_CLI\SynopsisValidator' not found in <em><u>hidden link</u></em> on line 254 [17-Dec-2018 15:58:42 UTC] PHP Stack trace: [17-Dec-2018 15:58:42 UTC] PHP 1. {main}() /usr/local/bin/wp:0 [17-Dec-2018 15:58:42 UTC] PHP 2. include() /usr/local/bin/wp:4 [17-Dec-2018 15:58:42 UTC] PHP 3. include() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 4. WP_CLI\bootstrap() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 5. WP_CLI\Bootstrap\LaunchRunner->process() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 6. WP_CLI\Runner->start() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 7. WP_CLI\Runner->_run_command() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 8. WP_CLI\Runner->run_command() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 9. WP_CLI\Dispatcher\Subcommand->invoke() <em><u>hidden link</u></em> [17-Dec-2018 15:58:42 UTC] PHP 10. WP_CLI\Dispatcher\Subcommand->validate_args() <em><u>hidden link</u></em>
I am working to get you information from the live site.
Thanks again,
Elizabeth
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Elizabeth
Those errors relate to the WP CLI, I'm not sure how they are connected, it may be that you have it installed and are using it on your production server but not on the test server you copied the site to?
Anyway, please let me know if the error logs on the production server contain the same (or anything else).
Also, did you check the browser console for JS errors?