Skip to content
ms-studio edited this page Nov 3, 2012 · 7 revisions

The plugin has two options that can be enabled by putting the following code into your functions.php file:

<?php
function my_mem_settings() {
  mem_plugin_settings( array( 'post', 'page', 'event' ), 'alpha' );
}
add_action( 'mem_init', 'my_mem_settings' );
?>

1. Restricting the plugin to specific content types

The first option - in our example above, it's the array( 'post', 'page', 'event' ) part - allows you to limit the plugin to specific post types. This parameter accepts an array of post types, or an array with "all" as the only value.

In our example, the MEM metabox would show up only for posts, pages, and a custom post type named "event" - it wouldn't appear on other custom post types.

2. Alpha mode vs. Regular mode

The second parameter will accept two values: "full" or "alpha".

If the full mode is set (as per default), the interface shows the dropdown menu for date selection, and applies input validation.

If the alpha mode is set, the interface will show a single entry field, that will accept any text string. It won't apply any input validation or error correction, it just saves the strings as they are entered.

This can be practical if you want to use some very special date format. If you are a paleology research institute, you can enter dates like this:

  • start : 199.6 million years ago
  • end : 145.5 million years ago

But of course, you will have to make sure that your WordPress theme parses and displays those dates according to your needs. The "alpha" mode leaves it totally open.

3. PS

You don't have to name the function my_mem_settings, you can call it however you like. But don't change mem_init and mem_plugin_settings.

References

For more information about the functions.php file in WordPress, refer to the Codex.