-
Author
-
November 16, 2014 at 02:50 #35636glikozParticipant
I need custom post type, i try to explain it with sample: (my site is not e-commerce site)
My Custom Post
Content(Description)
VendorInfo
ProductType
Color
InStockI think I can implement custom post type, but I don’t know how can I show it on main page differently
I’m sending CustomPostView for main page.
What is your suggestion. Avatar is Author’s Avatar!
I have c#, css, html knowledge.
Attachments:
You must be logged in to view attached files.November 16, 2014 at 04:16 #35639glikozParticipantI think I need help for showing single post content..
I could not see my custom fields on single post content..
I’m using https://wordpress.org/plugins/types/ .November 16, 2014 at 04:46 #35640glikozParticipantI’ve also tried this plugin Custom Post Type UI and https://wordpress.org/plugins/advanced-custom-fields/
and no chance to see my custom fields on your single post page.
November 16, 2014 at 14:42 #35673sharmstrModeratorI’m using Types. I’ll give you an outline of what I did on my site to integrate it with Kleo, but this is a lot of work and you really need to be asking your questions over on the Types forum.
To display your cpt in the format that you’ve provided a picture of, you’ll have to either code it yourself by creating a single-yourcptname.php file or use Views and/or Layouts plugins available from the same people who wrote the Types plugin.
Personally, I’m using their Views plugin for archive pages because I wanted the ability to sort/filter my CPT listing (See parametric search: http://wp-types.com/documentation/user-guides/front-page-filters/) . It was a bit of a chore because I had to recreate the Kleo masonry grid in their UI.
But for displaying the actual cpt single page I’m using the Types API. Here’s how I did it.
1 – I wanted to use some of Kleo’s options under “Theme General Settings” to allow my authors to use videos and Spotify playlist. By default those options only show up on WP Posts and Pages. To add it to your CPT you need to put this in your functions.php file
COPY CODEadd_filter( 'kleo_meta_boxes', 'kleo_my_metaboxes' ); function kleo_my_metaboxes( array $meta_boxes ) { // Start with an underscore to hide fields from custom fields list $prefix = '_kleo_'; $meta_boxes[] = array( 'id' => 'general_settings', 'title' => 'Media', 'pages' => array( 'yourcptname' ), // Post type 'context' => 'normal', 'priority' => 'default', 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => 'Slider', 'desc' => 'Used when you select the Gallery format. Upload an image or enter an URL.', 'id' => $prefix . 'slider', 'type' => 'file_repeat', 'allow' => 'url' ), array( 'name' => 'Media oEmbed URL', 'desc' => 'Used when you select Video format. Enter a Youtube, Vimeo, Soundcloud, etc URL. See supported services at <a target="_blank" href="http://codex.wordpress.org/Embeds" rel="nofollow">http://codex.wordpress.org/Embeds</a>.', 'id' => $prefix . 'embed', 'type' => 'oembed', ) ) ); return $meta_boxes; }
Again, I only wanted to show the media options, but you can add anything you want. Just look at /kleo/lib/metaboxes.php
2 – The next thing I did was copy all of the content files (i.e. content-image.php) from /kleo/content-xxx.php to /kleo-child/content-xxx.php My goal was to keep the standard kleo post layout, but add some information from my CPT meta info to the page, specifically between the media at the top of the post and the actual article content. To do so, I added the following just before ‘the_content–‘ call which allows me to inject whatever I want there.
COPY CODE<?php get_template_part('page-parts/yourcptname'); ?>
Note: @abe recently told me how to do this by hooking into the the_content filter, but I haven’t implemented it yet: https://archived.seventhqueen.com/forums/topic/handling-custom-post-types#post-34846 Potentially, this will allow me to do what I want without having to copy all of the content-xxx.php files to my child theme.
3 – Then I created a new file called yourcptname.php and put it in /kleo-child/page-parts/. That file has all of the Types code. You can learn all about outputting Types info using php here: http://wp-types.com/documentation/user-guides/displaying-wordpress-custom-fields/#1
That should give you enough information to do some damage. If you don’t know PHP, you should hire someone to help. With that said, there is a wealth of information about all of this in the Toolset forums: https://wp-types.com/forums/
Some final thoughts – Without fully understanding your requirement, I’d say you might be able to just copy /kleo-single.php to /kelo-child/single-yourcptname.php and edit that file so it outputs the Types custom meta info in the format you want. More info on that here: http://codex.wordpress.org/Post_Type_Templates
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 23, 2014 at 04:26 #36407glikozParticipantThanks for very detailed brief sharmstr..
Could I get your email sharmstr? I don’t want to share my domain adress and I need to show my implemantation on it?
Thanks.November 23, 2014 at 23:42 #36425sharmstrModeratorYou can reply privately here and I’ll be able to see it, but im on vacation so wont be able to help for another week or so
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
November 24, 2014 at 22:40 #36488AbeKeymasterthanks @sharmstr
enjoy your vacation 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.