• 0

custom post types


Question

Posted · Report post

What is the best way to display custom post types in DMS ? 

im using the Types pugin.

 

thanks 

ddyer

Share this post


Link to post
Share on other sites

10 answers to this question

  • 0

Posted · Report post

Hi ddyer - I'm not familiar with that plugin but would think it has shortcode capability you could use in a text box?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi ddyer,

 

I hit the same problem recently, and though I haven't come across a solution yet for me, one of the other solutions I've found so far might be suitable for you.

 

Types doesn't have a shortcode that you could use. However if you've set up your Custom Post Types correctly in Types, DMS will display them using its own archive page ( the same used for Posts). So if your Custom Post Type slug was 'case-studies' and it was set up correctly you would find all your custom posts at www.yourdomain.com/case-studies or www.yourdomain.com/blog/case-studies depending upon how you set up the CPT in Types. The problem with this is they display in exactly the same way as your blogroll does. Completely identical!! If you have Custom Fields associated with your Custom Post Type, they will not display either.

 

Types depends on you adjusting the postloop template file to add in the custom fields and to adjust the markup so you can have it display as you would want. However DMS and Framework do not have a postloop template the same way the 2013 theme does for example, so there is no way to directly template the Custom Post output except by using filters with hooks in the Functions file of your child theme. However at the moment I've not found out how to do that (I'm a complete novice when it comes to php, I know the basics, I can write a basic filter or action but this is beyond me at the moment!!)

 

In Pagelines Framework I used 'Post in Page' plugin (which can be found here:http://wordpress.org/plugins/posts-in-page/) , which gives you the ability to display a post or posts, a category or a custom post type/s or an individual post (by ID) within another Post or Page using a shortcode or a snippet of php in your template files. There is also a handy Template you can copy into your Child Theme folder and adjust to create custom layouts for your Custom Post Types or for a featured post etc. Its a very handy Plugin. That's great but it creates a reliance on another plugin I'm keen to avoid. Also I've not tested Post in Page with DMS yet.

 

The other option is to purchase Types complimentary Plugin 'Views' which works seamlessly with Types to allow you to display CPTs anywhere in your site and I believe (I've not looked at it closely) to adjust the markup that wraps around your CPTs, so you can create the layout you want. I've read forum posts where others have been using Views with DMS successfully.

 

DMS's built in support of properly declared Custom Post Types might be enough for your purposes, or maybe Post in Page or Views will work for you.

 

If anyone has any suggestions on how to adjust the Archive layout for Custom Posts and to add in Custom Fields using Filters and Hooks, I too would really appreciate it!! Otherwise I may be purchasing a Views licence...

2 people like this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Thanks so much for that input jamieg270 - it was incredibly helpful!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

jamieg270"] Thanks for your indepth feedback  and great insight. Have you read DMS post types article by Nick @[member="beardedavenger  http://betterdms.com/2013/09/11/dms-post-types/? He shows to use post types with DMS. 

 

Could a hook with Hooker plugin? Any plans for the Core developers of PL to create a versatile section or plugin? 

Pockets does custom post types but seems limited of how it is displayed on the front end.

Back to the drawing board lol

 

:geek:

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

There are multiple plugins available, both free and premium, that can help you to create and display custom post types and fields.  I can't see any reason to create hooks for this, as that only makes a relatively simple process more complex.  You'd have to know which hook to use, as well as the code to apply to the hook.

 

See http://forum.pagelines.com/topic/29920-custom-post-types-in-postloop/?hl=post+type

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Rob, As you say getting Custom Post Types to display is easy, as per your link or using the Types (or equivalent) plugin, DMS is pretty excellent at getting Custom Post Types to display out of the box. The problem is getting Custom Fields associated with your Custom Post Type to display, and adjusting the underlying Markup to present those Custom Fields the way you want them.

 

Lets say you make a Custom Field titled 'Project' that you would like to display as the main heading, at the moment I can't find a way of doing that. My Custom Post Type simply displays as another Blog entry. With 2013 template  you could create a custom template that would display your custom post type the way you want to. You can replicate this using Post in Page plugin with DMS (I think). Which is cool, however I find the more Plugins I rely upon to achieve something the more 'at risk' my site is of one of those links in the chain breaking, so I was searching for a way to avoid extra plugins if at all possible.

 

In other threads on this topic the suggestion has been to create a filter on a hook to swap out the post heading, with my Custom Field. In principle I understand how that works (I've used a filter with a hook to replace some of the default text such as 'Leave a Reply' above the comment field), its just my skill with php hasn't met that level yet. I would argue that a line of two of code in your functions file is arguably more efficient and less risk than using a plugin to achieve the same.

 

Anyway this isn't a complaint or a criticism of DMS, it just does things in a different way and I think DMS really is the next best thing since sliced bread!! This is more an issue of my ignorance when it comes to php. However I'm getting up to speed pretty quickly, I can do the very basic stuff so its only a matter of time and perseverance before I get there.

 

ddyer, thanks I had read that but forgotten about it. I will look into that more closely and see if I can test some stuff out. However what isn't clear from that post, (which Nick did mention was a broad overview), is how to create your custom loop, which is what I'm interested in.

 

Jake, no problem. I've been a member of these forums for a long time, and found solutions and suggestions for so, so much in the past, but never really participated. Its well past time I contributed what I can back to the Pagelines community.

 

 

I think for the moment until I find a more robust solution I'll try Post in Page with DMS and see how that works. I'll report back on progress and let you guys know how it goes.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

@jamieg270  Shouldn't the look be the result of applying a custom class to the custom post type, then styling it as needed?

 

Theoretically, a custom class or ID would allow you to style any element (post types included).

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Rob  Yes, if all you want to do is restyle the existing markup. But what about the custom fields which aren't displaying in DMS's loop? I need those to appear in the markup to be able to style them, and I need them to appear in a specific place in the markup with specific tags. What about elements I do not want, like some of the other meta data which appears under the Title. Yes you could adjust the css to take it out, but ideally you'd want it not to appear in the first place so you don't have to write additional redundant CSS. 

 

What about other scenarios where you want to wrap the loop output in your own markup so you have the underlying markup to display it the way you need or want, and using the correct semantic markup for the way its being displayed. WIth a custom loop you can do that.

 

At the moment the only way I can do this that I've found to date (as I don't know how to write the filter or which hook to add it to) is using Views (a paid for plugin) or Posts in Page, which is free, but intermittently updated.

 

ddyer  I've tested Posts in Page and it works with DMS. I've also been able to get the Custom Fields to display in a custom loop using Posts in Page. I'll post details soon.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

jamieg270 ive been playing around with plugin The Custom Content Type Manager has good short codes and widgets options to display post types.

 

look forward to seeing what you can achieve with Posts in Pages im hoping that PL releases a section or plugin soon. 

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

HI,

 

Firstly, if you're going to be using Custom Fields, I recommend Advanced Custom Fields plugin - http://www.advancedcustomfields.com/

You can then either add them via shortcode or use hooks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now