Don’t Delete Custom Fields on Quick Edit Save

October 20, 2014 (4 years ago)
WordPress, Plugins

When saving custom fields from a custom metabox, if the value is empty, usually the custom field is deleted. This is good, as it keeps from having lots of empty entries in the database.

However, it means that when you update from the “Quick Edit” menu, since your custom fields are not in the form, they will disappear. Not so good.

Here’s the fix.  Add this to your save function for the metabox:

 So, your save function should look something like this:

 

Custom Post Type for a Menu

August 29, 2014 (4 years ago)
PHP, Plugins

I created this simple plugin for a restaurant to post their menu online.

Here’s the plugin file (put in plugins directory).

It includes categories (for menu sections), and several parameters for each item.

Now here’s the menu category display page. Create a page named “archive-grille_menu.php” and upload to your theme directory. Replace the loop with this code:

(I listed the categories in two columns.)

 Next is the display page for each category:

Remember to change the divs and styling to match your page layout.

 You can see this plugin in action at: http://paradisegrille.net.

 

 

Skip to toolbar