• Hello!

    First off, thank you for that great theme! I really like OceanWP and it makes creating a web site so much easier.

    I’m developing a child theme based on OceanWP and recently created a plug-in to display a metabox with custom fields. Then I print a box at the end of blog posts to display a rating (e.g. for a product or hotel). OceanWP provides a set of post types and I would like to add my own type ‘Review’. Furthermore, I want my rating box to show up in posts of that type only. It should not show up in regular blog posts.

    However, I want my reviews to show up in the blog section. So, basically, my ‘Review’ post type should be a special variation of a regular post type, having an additional rating box at the end. Reviews should be handled the same as regular blog posts apart from that (i.e. show up in archive, have comments, be searchable…).

    How would I add another post type to my OceanWP child theme? I already found files for the pre-defined post types. Do I simply add mine there or do I have to register custom post types anywhere? Will it show up in the blog section?

    How do I make sure that my metabox is only available, when editing a post of my custom ‘Review’ type? I know this question is beyond OceanWP and more a general question of plug-in development, so maybe I’ll figure that out on my own. Any advice is greatly appreciated, though.

    Thanks in advance
    Bernd

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    You can register Custom Post Types using the below documentation along with a metabox associated with it.
    To display it in the post loop, you need to write your own custom function.

    https://codex.wordpress.org/Function_Reference/register_post_type
    https://codex.wordpress.org/Plugin_API/Action_Reference/add_meta_boxes

    Thread Starter actronab

    (@actronab)

    So I cannot extends the post formats that OceanWP provides and add a custom ‘Review’ format? I read up on that topic and it seems that post formats have a pre-defined set and you cannot add your own formats.

    That means, I’ll end up implementing my own post type, having a separate admin interface an adding my custom type manually to the Blog page. That’s far more complex than I expected.

    Maybe I’ll be better of, adding another boolean property to my metadata box ‘This is a review: yes/no’. Then I’ll just have a single edit page for blog entries in the admin interface, have regular blog posts and reviews on the Blog page and can enable/disable the rating box depending on that boolean property.

    Can you share a screenshot? I didn’t understand the term ‘post formats’ clearly – Form the OceanWP settings metabox or something else? Can you please elaborate more?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add custom post type for reviews’ is closed to new replies.