How can I display older custom post outside the loop in Wordpress?

In WordPress's custom post types what does the public argument do/represent?

  • I started with this: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress. No doubt Justin is the WP man. But scroll down a bit, please. It's not clear what exactly public does. Or what not-public is? Is the attachments post type public=>false?  As a side note I'm wanting to develop some code (read: plugin or shortcode) that is able to use conditional tags and such to fine tune what's displayed. For example, if it's page X display image X. If it's category Y disply image Y. If it's tag Z then display image Z. In theory it doesn't seem too difficult. However... What I can't seem to wrap my head around is customer post types. Maybe I'm over-thinking it? In terms of structure and WP functions, etc. are they just the same as builtin post types? I'm just trying to anticipate - as based on the structure - any type of output pages...interpret that page...and then display the image that was related to that page type. (I'm using page universally, and not being specific to WP pages. Tho' I need to interpret those as well.) Any thoughts and/or links would be appreciated, thanks.

  • Answer:

    The Public flag is used to determine whether the post type should be shown in the admin UI. On your other point: It depends where you want to display your picture. But as long as a theme calls body_tag() in the body tag, then you can, for instance, hook a background image based on one of the many classes that will be added to the page, there will be a class for category-slug, tag-sug, page-tag, etc. See http://codex.wordpress.org/Function_Reference/body_class

Mike Little at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.