- This topic has 7 replies, 3 voices, and was last updated 5 years, 1 month ago by
Tom.
-
AuthorPosts
-
March 9, 2017 at 11:57 am #289393
Robert
Hi, from what I can tell GP Pro does not have custom post type for portfolio/projects? WHats the best/easiest way to add this in?
Thanks.
GP Premium 1.2.94March 9, 2017 at 3:34 pm #289476Tom
Lead DeveloperLead DeveloperThat’s correct.
You can create a custom post type using a plugin like this: https://wordpress.org/plugins/custom-post-type-ui/
Let me know if you need more info 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 14, 2017 at 2:09 pm #291485David Sutherland
Hello… I am going to join in as I am also working on a project management system for my company. Two other suggestions for creating the custom post type are WP-Types (Toolset) and Pods Framework. Both of these go far beyond just creating the CPT and in my case essential.
My question pertains to the best way to go about setting up the archive and single pages specifically for the Projects post type. I imagine that these would need to be hard coded in the child theme. Is there any further info regarding this as it specifically relates to the GP Theme?
Kind Regards,
DaveMarch 14, 2017 at 6:47 pm #291631Tom
Lead DeveloperLead DeveloperGP will handle the templates by default, but if you need to customize them, then you would need to add the files to your child theme using the correct naming structure: https://codex.wordpress.org/Post_Type_Templates
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 17, 2017 at 11:33 am #293538David Sutherland
Hi Tom… I am using custom post types and I want to customize both the Archive as well as the Content in the loop. For example purposes lets use “Project” as my custom post type.
1. In my child theme I would need an archive-project.php file and a content-project.php file.?
2. After some time trying to get this to work I see you are using
get_post_format()
in the main archive.php file. After copying into my child theme and renaming I changed it toget_post_type()
. Is this correct as I am trying to display the archive and content for the project CPT?Kind Regards,
DaveMarch 17, 2017 at 6:54 pm #293683Tom
Lead DeveloperLead Developerarchive-project.php would handle your archives for the post types (blog page etc..). Things like the blog, categories, tags would fall back to this file if they didn’t have their own files (category-project.php etc..).
Then you would have single-project.php for your single posts.
get_post_type() simply outputs the current post type – it’s meant for checking (if post type is projects, do this).
You would use the standard functions you already see in archive.php and single.php to display your content.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMarch 18, 2017 at 5:24 pm #294091David Sutherland
Hi Tom… After rereading my previous post I don’t believe I was entirely clear. My question has to do with the section of code, see below, from the archive.php file that I copied to use as my starting point for my Project CPT Archive.
<?php /* Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?>
You will notice that the above code from the copied archive.php file uses
get_post_format()
and the only way I can see to get my setup working so that the content-project.php is pulled into my archive-project.php file, is to useget_post_type()
instead. If this change is needed then why isget_post_format()
being used in the themes archive.php file that ships with the theme?Kind Regards,
DaveMarch 18, 2017 at 8:50 pm #294132Tom
Lead DeveloperLead DeveloperIf you have a file called content-project.php, you would replace that line with:
get_template_part( 'content', 'project' );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-development -
AuthorPosts
- You must be logged in to reply to this topic.