Skip Navigation

[Resolved] displaying custom post types on a simple page

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by hossamH-2 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#573509

I have custom post type "countries" and simply want to display all countries on a page, so I have made a view listing all countries but the page shows blank and even with debug mode enabled, it doesn't load the popup window as if the view is not there. I presume this is because the page not quering the custom post type in the first place, right? If yes, how do I do this? If no, then what I am missing?

#573534

Dear Hossam,

If you see a blank wordpress page, that means there are some PHP errors in your website, please check these:
1) You are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
2) In case there are other compatibility problem in your website, please deactivate other plugins and switch to wordpress default theme, and test again
3) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

#573584

Sorry, it's not blank as how you got it. I meant simply that the view is not loading. Anything else is displayed properly. This is on a live production site (url was given in the support ticket) and there are no conflicts whatsover between the plugin and the other plugins. My question is simple: how to display the view on a page? Sorry if my question sounded too complicated.

#573597

For your question:
how to display the view on a page?

Please try with Views shortcode [wpv-view]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view
Will render the view on your page, post or in another view or Content template.

If you are using shortcode [wpv-view] to display the view, but it does not output anything, then the problem is abnormal, please try as I mentioned above:
https://toolset.com/forums/topic/displaying-custom-post-types-on-a-simple-page/#post-573534

If the problem persists without compatibility problem, please provide a database dump file(ZIP file) of your website in below private detail box, I need to duplicate same problem and debug it in my localhost. thanks

#573611

Q1) Are you saying that it is possible to display the contents of a custom post type on a normal wordpress page that has nothing to do with the custom post type without any custom PHP code in functions.php and just using the simple shortcode?
Yes, it is possible to display information of custom posts in a wordpress page, that is built-in feature of Views plugin, please check our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view
Will render the view on your page, post or in another view or Content template

Q2) 2. If yes, how should I troubleshoot this since everything else is working okay? For an example, the posts of the custom post type shows as they should. the archive page is working, etc..
I have already provide you the troubleshoot method here:
https://toolset.com/forums/topic/displaying-custom-post-types-on-a-simple-page/#post-573534
And
https://toolset.com/forums/topic/displaying-custom-post-types-on-a-simple-page/#post-573597

If you still need assistance for the debug, please provide the database dump file of your website, I can debug it in my localhost.

#573613

Even though I have made way more complicated views on the site that worked perfectly, I didn't know (or in better words, I understood wrong ) that in order to display a view on a page or post that don't query the custom post type, I will have to do the query via PHP in the functions.php file or theme files or something. It appeared eventually that I have mistakenly used the plural name of the view instead of its slug or name, and now it display just right. Thanks for your swift support,

The forum ‘Types Community Support’ is closed to new topics and replies.

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