[wp-hackers] sticky for custom post types

Steve Taylor steve at sltaylor.co.uk
Sat Mar 5 11:52:59 UTC 2011

On 5 March 2011 00:55, Mike Schinkel <mikeschinkel at newclarity.net> wrote:
> I think the issue is that Custom Post Types were envisioned for
> use-cases that are not how you are using them; they are for things
> like "Products" and "Real Estate Properties" and so on; not
> chronology-based entries like your uses.  And I agree with that
> perspective.

Of course I've no desire to resurrect the early confusion over the
naming of CPTs (which, as they stand, are better as Custom Content
Types). I'm looking less at the word "Post" in the name than I am at
the word "Custom". Custom, as in, changeable; I can do what I want
with them.

Why shouldn't I be able to list my Real Estate Properties in
reverse-chronology by default? Even if the main Properties page has
them arrayed on a map, for instance, wouldn't it be entirely
reasonable to list the "latest properties" on the home page? This is
surely one of the most common ways of including different types of
site content on the home page, and it implies reverse chronology, and
that use of the Sticky flag would be very, very useful. At least worth
having as an option in register_post_type.

> What you probably really want is a "Post Class" (as I coin a new
> concept in this email.) A "Post Class" would let you modify the
> standard post_type="post" and give it custom metaboxes.

Thanks - a good possible workaround. However, I don't (and I'm
guessing you don't) see this as any kind of feature request - types,
formats, now "classes"? No - it's a workaround until CPTs become truly

On 5 March 2011 07:56, Guillem Frances <guillem.frances at gmail.com> wrote:
> you've probably already considered this, but couldn't you just use one
> custom taxonomy with a single term "promoted", then make the client assign
> this term to those posts that she wants to see on the on the home page
> regardless of their publish date? Or even use an entry in the postmeta
> table, and manually create a simple checkbox that appears on the admin
> interface of each of your CPTs?
> Depending of your requirements, I guess that you might end up having to
> build your own query to retrieve the promoted posts plus the most recent
> non-promoted ones, or maybe use to simple queries, but that might be
> acceptable.

I have a plugin
(http://sltaylor.co.uk/wordpress/plugins/slt-custom-fields/) to manage
custom fields, so of course this is a fallback. The issue, as you say,
is that you potentially need to do 2 queries - one to get "promoted"
items, and one to get the latest ones if there's no enough that are
promoted. I've got tabs on the home page with 4 different content
types to pull through, which comes to up to 8 queries.

Of course caching (with transients or with a plugin) will remedy this
to a degree. But it still all feels like working around a simple
omission in the CPT spec :-/

Thanks anyway,


More information about the wp-hackers mailing list