Custom Post Type Display on Page (separate from blog posts)

I am trying to create a simple page that will just display my custom posts (created by your CustomPress plugin) same style as the blog posts are displaying. These custom post types I created are upper level membership specific and fall on a different page than the blog posts. I know there has to be a simple way to add a shortcode (or whatever it takes) to this page that allows to display feed of the custom posts with the same default styling used currently in the recent blog posts shortcode?

I'm not a wordpress or code expert but know enough to be dangerous, so please explain where I put what, and thank you so much for helping me figure this out!!

  • Luís

    Hi Joey Martin ,

    Hope you're doing well today!

    It's possible that you will need to create a template to your "archive page", the page that will display all posts of your custom post type, based on the template of the "blog" page.

    Can you give us access to your admin panel, so I can help you better?

    If you don't already know, please, follow the link below, to see how enable the staff login:

    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    When you enable this option, please post again!

    Cheers, Luís

  • Joey Martin

    Okay, you're good to go, thank you!! I actually want to have two pages, one for each post type:

    Style Vault - http://yourstylevault.com/style-vault
    This page should only show Style Vault posts.

    YSV Complete - http://yourstylevault.com/style-vault-complete
    This page should show both Style Vault & YSV Complete posts.

    So this page http://yourstylevault.com/style-blog is what I want the two new pages to look like only they will display the corresponding post types and should create an archive in the future. In theory, these custom post types should act same as the blog posts do..same categories and tags, same pagination, same display, and same ability to show recents in sidebars, etc..thank you!!

    I am LOVING WPMUDEV!!! Who knew you were out there?? :slight_smile:

  • Joey Martin

    HEre is where I stand after speaking to live support:

    joey Martin Getting back to your question: that's a bit general question so I can only server here with a bit general answer as well, unfortunately. As for templates: I assume you're referring to custom template files so those should be located inside the folder of your current theme /wp-content/themes/your_current_folder As for shortcodes: on Multisite - those should be available across the network I think; on single/regular install - it depends where they are located (e.g. functions.php file of the theme or inside template files - which is not recommended solution - or as MU plugin). The best scenario would be if me or one of my colleagues from support could just check your site's setup and then we would be sure. I suppose you already started a thread on this, is that right?
    Adam Czajczyk

    Adam Czajczyk
    Joey Martinat 2:58 pm
    yes, and I just made sure you still have access via support tab in WPMUDEV Dashboard..
    Adam Czajczyk
    Adam Czajczykat 2:58 pm
    joey Martin can you share a link to this thread with me?

    Joey Martin
    Joey Martinat 3:00 pm
    the girl yesterday on chat gave some good info too towards the end but the thread is here (and I am not asking for custom dev by you..only that you help me accomplish on my own. :slight_smile: - https://premium.wpmudev.org/forums/topic/custom-post-type-display-on-page-separate-from-blog-posts#post-1111326
    Adam Czajczyk

    Joey Martinat 3:01 pm
    didnt want the thread to confuse you...thanks!
    Adam Czajczyk
    Adam Czajczykat 3:01 pm
    joey Martin I never implied that you're asking for custom dev :slight_smile: Let me see the thread first though :slight_smile:
    Joey Martin
    Joey Martinat 3:03 pm
    I know..just helping

    Joey Martin
    Joey Martinat 3:05 pm
    not using multi site or anything either..
    step 1.. :wink:
    Adam Czajczyk
    Adam Czajczykat 3:06 pm
    joey Martin okay. you created custom posts and you just need to create templates so they'd be displayed on your blog the same way as regular posts right? You need to create a template file inside your current theme folder. Let me just give you an example. Let's say that the custom post is called "cars". You need to create a "archive-cars.php" file to show archive of these posts and "single-cars.php" to show "single post". You can simply copy and rename existing "archive.php" and "single.php" files in most cases to achieve this.
    Adam Czajczyk

    Adam Czajczyk
    Adam Czajczykat 3:07 pm
    joey Martin I think this may be of help for you: https://developer.wordpress.org/files/2014/10/template-hierarchy.png
    Joey Martin
    Joey Martinat 3:07 pm
    okay..so then how do I add them to the page - same as the recent posts shortcode but select new post type?
    Joey Martin
    Joey Martinat 3:07 pm
    thank you..
    Adam Czajczyk
    Adam Czajczykat 3:09 pm
    joey Martin no, you don't have to use any shortcodes. So called "template hierarchy" would do the job. I mean - you can link to any of your custom type posts just like to any other posts and if the template (as explained above) exists it will be automatically picked up.
    Adam Czajczyk
    Adam Czajczykat 3:10 pm
    joey Martin If you however want to list those custom posts on some other page/post you'll need to dive a bit deeper and create custom WP loop: https://codex.wordpress.org/The_Loop using WP Query to query DB for specified post type: https://codex.wordpress.org/Class_Reference/WP_Query
    Joey Martin
    Joey Martinat 3:11 pm
    let me do so, and the folder holding these template files is the theme folder, right?
    Adam Czajczyk
    Adam Czajczykat 3:11 pm
    joey Martin yes, that's right :slight_smile:
    Joey Martin
    Joey Martinat 3:11 pm
    Need pages yourstylevault.com/style-vault and yourstylevault.com/style-vault-complete to display their new custom post types same styling and rules as the blog post page located at yourstylevault.com/style-blog - thank you!! Just point me in the right direction..
    Joey Martin
    Joey Martinat 3:11 pm
    so each custom post type has it's own page
    Joey Martin
    Joey Martinat 3:12 pm
    Blog - Style Vault - Style Vault Complete
    Joey Martin
    Joey Martinat 3:12 pm
    is this the first option or the dig deeper option?
    Adam Czajczyk
    Adam Czajczykat 3:12 pm
    joey Martin Yes, it has its own slug (URL) and also if the custom template file exists it will pick it up.
    Adam Czajczyk
    Adam Czajczykat 3:13 pm
    joey Martin no, it's the "first option". the second would be if you e.g. would like to display your custom posts e.g. on some other post/page
    Adam Czajczyk
    Adam Czajczykat 3:13 pm
    but generally, the "first option" should do the trick for you I think :slight_smile:
    Joey Martin
    Joey Martinat 3:14 pm
    okay so I am going to: 1) copy archive.php and single.php and rename both for each post type 2) is that it?
    Joey Martin
    Joey Martinat 3:14 pm
    then choose that page template for those pages and it'll stream accordingly..be right back - how much longer are you here today
    Adam Czajczyk
    Adam Czajczykat 3:14 pm
    yes, start with this. In most cases this works unless the theme is that complex that some more files must be modified. So, if this doesn't work for you please update your thread with what we talked here about and what you tried and we'll continue in a thread.
    Adam Czajczyk
    Adam Czajczykat 3:15 pm
    joey Martin no, you don't have to choose that template. it will be automatically picked up if done properly.
    Adam Czajczyk
    Adam Czajczykat 3:15 pm
    We're already behind the schedule and I'm ending the chat now.
    Joey Martin
    Joey Martinat 3:16 pm
    can i get a transcript?
    Adam Czajczyk
    Adam Czajczykat 3:16 pm
    in case it didn't work, please update the thread and we will continue there.

  • Joey Martin

    I have created those 4 files just by duplicating them and changing their names - what next? I DO want these posts living on their own pages so that the blog posts are shown on blog page, style-vault posts are shown on /style-vault page, and style-vault-complete posts shown on /style-vault-complete page..each are accessed by members at different price points and need to be separated out

    What next..I'm eager to get this working for client :slight_smile: thanks!!