I am not sure how to use custom posts in WordPress. I have tried them with the plugin’s but, the problem here is when I have deactivated plugins which are not useful then the related posts are going down. I want to make them available. Is there any easy way to post them?
2
Answers
You can add custom post type in WordPress by placing this in you theme functions file, you can also place this in must use plugin to for using it in all themes.
In view use the normal WordPress loop, just add this to your arguments,
The problem with using a plugin is that your custom post types will disappear when the plugin is deactivated. Any data you have in those custom post types will still be there ,but your custom type will be unregistered and will not be accessible from the admin area.
You can use below code for the custom posts:
$args = array( ‘post_type’ => ‘blog’, ‘post_per_page ’ => 10 ); $loop = new WP_Query(args ); While ( $loop-> have_posts() ): $loop->the_post(); the_title(); echo’<div class = ” entry-content “ >’; the_content(); echo’’; endwhile;
Reference :
https://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/