0

I don't know if the title is correct but I'll try to explain my question below.

I have created a custom post type "Projects" and the trick is that one project have to be unique and displayed on home page.

I was thinking about adding a checkbox in post edit page and if it's checked post ID will be saved somewhere (I dont know where and how, so please help). In case that another post is checked as unique, old value will be overwritten, so only one post will always be active (unique).

My question is where to save this kind of data as I don't want to create a custom table (if not necessary), and saving in post meta is not suitable for this use case. And also how to retrieve this data form wp DB?

0

I think that question is solvable easy-

There is a way to add custom meta box. You can basically copy this from here: add_meta_box

Now, make a checkbox in the custom meta box and a hidden field with the post id. Instead of updating post meta with

update_post_meta( $post_id, '_my_meta_value_key', $my_data );

you now can do update_option in WordPress which is global.

  • Just a friendly request, please work on your formatting so that others don't have to. :-) Thank you – Pieter Goosen Mar 12 '15 at 14:09
  • thx for quick answer. – isBatak Mar 12 '15 at 14:12

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.