1

The client wants to attach one of several "formats" (publication, briefing, press release etc.) to a post. It seems unnecessary to create custom post types as they all have the same fields.

As post formats cannot be extended, would you recommend a custom taxonomy in this case?

  • 1
    You'll need to sort that out yourself unfortunately :-). You'll need to go and look at the context of the site and how all of this will be managed and how do they interlinked to each other. Whether you decide on categories, custom taxonomies or custom post types, it will all rely on what will firt in with the current context or planned context and content of the site – Pieter Goosen Jul 22 '14 at 14:39
  • Given that the context is that this is just a predefined label that should be added to posts which are otherwise the same, isn't custom taxonomy a reasonable alternative? Or what other parameters would you consider? – dani Jul 22 '14 at 14:41
  • 1
    My opinion, normal categories will also do the trick. There is no need for any extra coding – Pieter Goosen Jul 22 '14 at 14:45
  • I am using normal categories for topics so perhaps better to make a separate taxonomy called "post format"? – dani Jul 22 '14 at 14:57
  • 1
    Side note: if I recall correctly, post format is actually a taxonomy as well. – karpstrucking Jul 22 '14 at 17:34
0

If you say that it's all the same boxes and format anyway, I would create a custom text meta box on the edit page for their posts where they can just type the category (CSS class).

That way they have control in the edit page for which category it belongs to at time of writing (or can easily go back through posts and change without any coding knowledge necessary.)

In the code you can then simply do something like:

 <?php 
    $yourclasskey = class //choose the name for the meta_key
    $class = get_post_meta( get_the_ID(), $yourclasskey , true );
 ?>
 <div class="<?php echo $class ?>">
 //The Post
 </div>

Then adjust the CSS to change the style they want depending on the publication.

You could also just use tick boxes in the back and return the values of the class that way??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.