Custom Fields
Re-Envisioned
Support Meta Box Include Exclude Include/Exclude not working

This topic contains 3 replies, has 2 voices, and was last updated by  Anh Tran 4 years, 6 months ago.

  • Creator
    Topic
  • #444

    evoknow
    Participant

    Just purchased the Include/Exclude plugin and did the following:

     

    1.  Removed the original metabox plugin

    2. Installed the Include Exclude plugin

    3. In theme’s function.php I have the following code segment.

    4. When I go to Add New Page and  select one of the page templates (Basic or Basic with Hero) which are supposed to include the custom fields, nothing happens.

    Please help.

    ===== code in functions.php ===

    add_filter( ‘rwmb_meta_boxes’, ‘evoknow_register_meta_boxes’ );

     

    function evoknow_register_meta_boxes( $meta_boxes )

    {

    $prefix = ‘rw_’;

    // 1st meta box

    $meta_boxes[] = array(

    ‘id’       => ‘personal’,

    ‘title’    => ‘Hero Template Specific Custom Fields’,

    ‘pages’    => array( ‘post’, ‘page’ ),

    ‘context’  => ‘normal’,

    ‘priority’ => ‘high’,

     

     

     

    ‘include’ => array(

    // With all conditions below, use this logical operator to combine them. Default is ‘OR’. Case insensitive. Optional.

    ‘relation’ => ‘OR’,

     

    // List of page templates. Can be array or comma separated. Optional.

    ‘template’ => array( ‘page-basic.php’, ‘page-basic_hero.php’ ),

     

    ),

     

    ‘fields’ => array(

    array(

    ‘name’  => ‘Hero Title’,

    ‘desc’  => ‘Format: 200 characters or less’,

    ‘id’    => $prefix . ‘hero_title’,

    ‘type’  => ‘text’,

    ‘std’   => ‘Enter a title’,

    ‘class’ => ‘custom-class’,

    ‘clone’ => false,

    ),

     

    array(

    ‘name’  => ‘Hero Banner’,

    ‘id’    => $prefix . ‘hero_banner’,

    ‘type’  => ‘file_advanced’,

    ‘std’   => ‘Upload a banner’,

    ‘class’ => ‘custom-class’,

    ‘clone’ => false,

    ),

    )

    );

    // 2nd meta box

    $meta_boxes[] = array(

    ‘title’    => ‘Media’,

    ‘pages’    => array( ‘movie’, ‘slider’ ),

    ‘fields’ => array(

    array(

    ‘name’ => ‘URL’,

    ‘id’   => $prefix . ‘url’,

    ‘type’ => ‘text’,

    ),

    )

    );

     

    return $meta_boxes;

    }

     

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #445

    evoknow
    Participant

    OK here is what I have now:

     

    1. Added the metabox plugin back

    2. Now when I select one of the Page templates that is suppose to fire the meta box it does not still fire the meta box but if I update the post (Save Draft for example), I get the meta box!

    But what I thought should have been happening is:

    1. When I select the page template, it should have fired the meta box

    Now I am thinking, do I need the Javascript version to have this effect? Ideally, whenever user selects the page template associated with the metabox, it (the  meta box) should show up.

     

    #447

    evoknow
    Participant

    OK I purchased your JS plugin and not we are good!

    I really should have bought the JS plugin instead of the Include/Exclude. Bit confusing on how you describe it on the site.

     

    Thanks.

    #448

    Anh Tran
    Keymaster

    Hi evoknow, I’m glad you solved the problem. Perhaps the description of 2 extensions is confusing. I’ll update them now to make it clearer.

    Thanks and best regards

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

The topic ‘Include/Exclude not working’ is closed to new replies.