Help! Can't make it work

Support MB Show Hide Help! Can't make it work

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1151
    cogliaWhocogliaWho
    Participant

    Hi!

    I've just bought the extension.
    Installed through the plug in install.
    I'm working on a child theme that inherits twentyfifteens.

    In my functions.php I'm adding the following:

    add_filter( 'rwmb_meta_boxes', 'hslt_register_meta_boxes' );
    
    function hslt_register_meta_boxes( $meta_boxes )
    {
        $prefix = 'hslt_';
    
        // 1st meta box
        $meta_boxes[] = array(
            'id'       => 'ImgText',
            'title'    => 'Testo Immagine',
            'pages'    => array( 'page' ),
            'context'  => 'normal',
            'priority' => 'high',
    
            'exclude' => array(
                    'relation' => 'OR',
                    'ID' => array( 58 )
                ),
    
            'fields' => array(
                array(
                    'name'  => 'Testo Immagine',
                    'desc'  => 'Testo che compare al di sotto delle immagine nei template di primo e secondo livello',
                    'id'    => $prefix . 'testoImg',
                    'type'  => 'wysiwyg',
                    'std'   => 'Anh Tran',
                    'class' => 'custom-class',
                    'clone' => true
                ),
            )
        );
    
        return $meta_boxes;
    }

    The problem is that I can see the custom metabox in the page editor and in the client side version.

    What I'm missing? Did I jumped some steps?

    My final goal is to create metaboxes visible only on specific pages.

    This is how I print the metaboxes value in the fornt end:

    <?php
                $textboxes = rwmb_meta( 'hslt_testoImg' );
    
                if (is_array($textboxes))
                {
                    foreach ($textboxes as $value)
                    {
                        echo $value;
                    }
                } else {
                  echo "Qualcosa รจ andato storto. Contatta l'amministratore.";
                }
              ?>

    Help please!

    thank you and have a good day.

    #1158
    Anh TranAnh Tran
    Keymaster

    You're using exclude which means do not show on these pages (show on all pages except these). You just need to change it to include which means show only on these pages.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Help! Can't make it work’ is closed to new replies.