/**
 * Add my metaboxes for the Books pod
 *
 * $type (string)
 *   The type of object (post_type, taxonomy, media, user, or comment)
 *
 * $name (string)
 *   The name of the object (pod name, post type, taxonomy name,
 *   media, user, or comment)
 */
function my_metaboxes($type, $name)
{
    // Add a new meta group for the Books post type
    pods_group_add('books', 'Book Information', 'preface,isbn');
    // Add a new shared meta group to the Books and Other Books post types
    pods_group_add(array('books', 'other_books'), 'Book Information', 'preface,isbn');
}
Exemple #2
0
 /**
  * Add meta boxes to the page
  *
  * @since 2.0
  */
 public function add_meta_boxes()
 {
     $pod = array('name' => $this->object_type, 'type' => 'post_type');
     if (isset(PodsMeta::$post_types[$pod['name']])) {
         return;
     }
     if (!function_exists('get_page_templates')) {
         include_once ABSPATH . 'wp-admin/includes/theme.php';
     }
     $page_templates = apply_filters('pods_page_templates', get_page_templates());
     $page_templates[__('-- Page Template --', 'pods')] = '';
     $page_templates[__('Custom (uses only Pod Page content)', 'pods')] = '_custom';
     if (!in_array('pods.php', $page_templates) && locate_template(array('pods.php', false))) {
         $page_templates[__('Pods (Pods Default)', 'pods')] = 'pods.php';
     }
     if (!in_array('page.php', $page_templates) && locate_template(array('page.php', false))) {
         $page_templates[__('Page (WP Default)', 'pods')] = 'page.php';
     }
     if (!in_array('index.php', $page_templates) && locate_template(array('index.php', false))) {
         $page_templates[__('Index (WP Fallback)', 'pods')] = 'index.php';
     }
     ksort($page_templates);
     $page_templates = array_flip($page_templates);
     $fields = array(array('name' => 'page_title', 'label' => __('Page Title', 'pods'), 'type' => 'text'), array('name' => 'code', 'label' => __('Page Code', 'pods'), 'type' => 'code', 'attributes' => array('id' => 'content'), 'label_options' => array('attributes' => array('for' => 'content'))), array('name' => 'precode', 'label' => __('Page Precode', 'pods'), 'type' => 'code', 'help' => __('Precode will run before your theme outputs the page. It is expected that this value will be a block of PHP. You must open the PHP tag here, as we do not open it for you by default.', 'pods')), array('name' => 'page_template', 'label' => __('Page Template', 'pods'), 'type' => 'pick', 'data' => $page_templates));
     pods_group_add($pod, __('Page', 'pods'), $fields, 'normal', 'high');
     $associated_pods = array(0 => __('-- Select a Pod --', 'pods'));
     $all_pods = pods_api()->load_pods(array('names' => true));
     if (!empty($all_pods)) {
         foreach ($all_pods as $pod_name => $pod_label) {
             $associated_pods[$pod_name] = $pod_label . ' (' . $pod_name . ')';
         }
     } else {
         $associated_pods[0] = __('None Found', 'pods');
     }
     $fields = array(array('name' => 'pod', 'label' => __('Associated Pod', 'pods'), 'default' => 0, 'type' => 'pick', 'data' => $associated_pods, 'dependency' => true), array('name' => 'pod_slug', 'label' => __('Wildcard Slug', 'pods'), 'help' => __('Setting the Wildcard Slug is an easy way to setup a detail page. You can use the special tag {@url.2} to match the *third* level of the URL of a Pod Page named "first/second/*" part of the pod page. This is functionally the same as using pods_var( 2, "url" ) in PHP.', 'pods'), 'type' => 'text', 'excludes-on' => array('pod' => 0)));
     pods_group_add($pod, __('Pod Association', 'pods'), $fields, 'normal', 'high');
     $fields = array(array('name' => 'admin_only', 'label' => __('Restrict access to Admins?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'restrict_role', 'label' => __('Restrict access by Role?', 'pods'), 'help' => array(__('<h6>Roles</h6> Roles are assigned to users to provide them access to specific functionality in WordPress. Please see the Roles and Capabilities component in Pods for an easy tool to add your own roles and edit existing ones.', 'pods'), 'http://codex.wordpress.org/Roles_and_Capabilities'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'roles_allowed', 'label' => __('Role(s) Allowed', 'pods'), 'type' => 'pick', 'pick_object' => 'role', 'pick_format_type' => 'multi', 'pick_format_multi' => 'autocomplete', 'pick_ajax' => false, 'default' => '', 'depends-on' => array('restrict_role' => true)), array('name' => 'restrict_capability', 'label' => __('Restrict access by Capability?', 'pods'), 'help' => array(__('<h6>Capabilities</h6> Capabilities denote access to specific functionality in WordPress, and are assigned to specific User Roles. Please see the Roles and Capabilities component in Pods for an easy tool to add your own capabilities and roles.', 'pods'), 'http://codex.wordpress.org/Roles_and_Capabilities'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'capability_allowed', 'label' => __('Capability Allowed', 'pods'), 'type' => 'pick', 'pick_object' => 'capability', 'pick_format_type' => 'multi', 'pick_format_multi' => 'autocomplete', 'pick_ajax' => false, 'default' => '', 'depends-on' => array('restrict_capability' => true)), array('name' => 'restrict_redirect', 'label' => __('Redirect if Restricted?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'restrict_redirect_login', 'label' => __('Redirect to WP Login page', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true, 'depends-on' => array('restrict_redirect' => true)), array('name' => 'restrict_redirect_url', 'label' => __('Redirect to a Custom URL', 'pods'), 'default' => '', 'type' => 'text', 'depends-on' => array('restrict_redirect' => true, 'restrict_redirect_login' => false)));
     pods_group_add($pod, __('Restrict Access', 'pods'), $fields, 'normal', 'high');
 }
Exemple #3
0
 /**
  * Add meta boxes to the page
  *
  * @since 2.0
  */
 public function add_meta_boxes()
 {
     $pod = array('name' => $this->object_type, 'type' => 'post_type');
     if (isset(PodsMeta::$post_types[$pod['name']])) {
         return;
     }
     $fields = array(array('name' => 'helper_type', 'label' => __('Helper Type', 'pods'), 'type' => 'pick', 'default' => 'display', 'data' => array('input' => 'Input (change form fields)', 'display' => 'Display (change field output when using magic tags)', 'pre_save' => 'Pre-Save (change form fields before saving)', 'post_save' => 'Post-Save', 'pre_delete' => 'Pre-Delete', 'post_delete' => 'Post-Delete')), array('name' => 'code', 'label' => __('Code', 'pods'), 'type' => 'code'));
     pods_group_add($pod, __('Helper', 'pods'), $fields, 'normal', 'high');
 }
Exemple #4
0
 /**
  * Add meta boxes to the page
  *
  * @since 2.0
  */
 public function add_meta_boxes()
 {
     $pod = array('name' => $this->object_type, 'type' => 'post_type');
     if (isset(PodsMeta::$post_types[$pod['name']])) {
         return;
     }
     $fields = array(array('name' => 'admin_only', 'label' => __('Show to Admins Only?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'restrict_capability', 'label' => __('Restrict access by Capability?', 'pods'), 'help' => array(__('<h6>Capabilities</h6> Capabilities denote access to specific functionality in WordPress, and are assigned to specific User Roles. Please see the Roles and Capabilities component in Pods for an easy tool to add your own capabilities and roles.', 'pods'), 'http://codex.wordpress.org/Roles_and_Capabilities'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'capability_allowed', 'label' => __('Capability Allowed', 'pods'), 'type' => 'pick', 'pick_object' => 'capability', 'pick_format_type' => 'multi', 'pick_format_multi' => 'autocomplete', 'pick_ajax' => false, 'default' => '', 'depends-on' => array('restrict_capability' => true)));
     pods_group_add($pod, __('Restrict Access', 'pods'), $fields, 'normal', 'high');
 }
Exemple #5
0
 /**
  * Add meta boxes to the page
  *
  * @since 2.0
  */
 public function add_meta_boxes()
 {
     $pod = array('name' => $this->object_type, 'type' => 'post_type');
     if (isset(PodsMeta::$post_types[$pod['name']])) {
         return;
     }
     $fields = array(array('name' => 'code', 'label' => __('Content', 'pods'), 'type' => 'code'));
     pods_group_add($pod, __('Template', 'pods'), $fields, 'normal', 'high');
     $fields = array(array('name' => 'admin_only', 'label' => __('Show to Admins Only?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'restrict_capability', 'label' => __('Restrict access by Capability?', 'pods'), 'default' => 0, 'type' => 'boolean', 'dependency' => true), array('name' => 'capability_allowed', 'label' => __('Capability Allowed', 'pods'), 'help' => __('Comma-separated list of cababilities, for example add_podname_item, please see the Roles and Capabilities component for the complete list and a way to add your own.', 'pods'), 'type' => 'text', 'default' => '', 'depends-on' => array('restrict_capability' => true)));
     pods_group_add($pod, __('Restrict Access', 'pods'), $fields, 'normal', 'high');
 }