Forum Replies Created

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • in reply to: piklist Gutenberg compatibility #9337
    noobie
    Participant
    This reply has been marked as private.
    in reply to: piklist Gutenberg compatibility #9327
    noobie
    Participant
    This reply has been marked as private.
    in reply to: Widget Code Does Not Work #8466
    noobie
    Participant

    Dear Steve

    Noted with thanks.

    in reply to: Widget Code Does Not Work #8464
    noobie
    Participant

    Dear Steve

    Any suggestions?

    in reply to: Widget Code Does Not Work #8463
    noobie
    Participant

    Dear Steve

    It ended up with the below error after installing with the beta version.
    Fatal error: Can’t use function return value in write context in /wp-content/plugins/piklist/includes/class-piklist.php on line 2669

    May I know what should I do to fix this?

    in reply to: Hiding Meta Box for Specific Template #8391
    noobie
    Participant

    Dear Steve

    Thank you so much. It works now.

    in reply to: Hiding Meta Box for Specific Template #8388
    noobie
    Participant

    Dear Steve

    May I check if you have received the theme file?

    in reply to: Hiding Meta Box for Specific Template #8386
    noobie
    Participant

    Dear Steve

    I have sent you, the file.
    Please have a look.

    in reply to: Hiding Meta Box for Specific Template #8384
    noobie
    Participant

    Dear Steve

    Apologies, the metabox is still NOT showing.

    in reply to: Hiding Meta Box for Specific Template #8383
    noobie
    Participant

    Dear Steve

    Yes, I have a page “Home” using template “Home Page” (filename: page-home.php).
    But the metabox is still showing.

    comment block as per below:

    /*
    Title: Right Bar Section
    Description: Customized right bar section
    Post Type: page, cpt_promo, cpt_news_event
    Hide for Template: page-home
    Order: 3
    */
    
    in reply to: Hiding Meta Box for Specific Template #8381
    noobie
    Participant

    Dear Steve

    May I know how you got it working?

    in reply to: Hiding Meta Box for Specific Template #8379
    noobie
    Participant

    Dear Steve

    Sorry for the trouble, I used the same codes from tutorial but is still not working.
    Please advice.

    in reply to: Hiding Meta Box for Specific Template #8377
    noobie
    Participant

    Dear riotxoa

    Once again thank you for your assistance. Unfortunately, it still does not work as expected.

    Codes as below:

    add_filter('piklist_part_data', 'my_custom_comment_block', 10, 2);
    function my_custom_comment_block($data, $folder)
    {
        // If not a Meta-box section than bail
        if($folder!= 'meta-boxes')
        {
            return $data;
        }
    
        // Allow Piklist to read our custom comment block attribute: "Hide for Template", and set it to hide_for_template
        $data['hidefortemplate'] = 'Hide for Template';
    
        return $data;
    }
    
    add_filter('piklist_part_process_callback', 'my_hide_for_template', 10, 2);
    function my_hide_for_template($data, $type)
    {
        global $post;
    
        // If not a meta box than bail
        if($type != 'meta-boxes')
        {
            return $data;
        }
    
        // Check if any page template is set in the comment block
        if (!empty($data['data']['hidefortemplate']))
        {
            // Get the active page template
            $active_template = pathinfo(get_page_template_slug($post->ID), PATHINFO_FILENAME);
    
            // Is there a page template set for this page?
            if(!empty($active_template))
            {
                // Does the active page template match what we want to hide?
                if (strpos($data['data']['hidefortemplate'], $active_template) !== false)
                {
                    // Change meta-box access to user role: no-role
                    return;
                }
            }
        }
        return $data;
    }
    
    in reply to: Hiding Meta Box for Specific Template #8375
    noobie
    Participant

    Dear riotxoa

    Thanks you for your assistance but it does not work as per your suggestions. The meta box just wouldn’t hide from the specific page template.

    Codes as per below:

    add_filter('piklist_part_data', 'my_custom_comment_block', 10, 2);
    function my_custom_comment_block($data, $folder)
    {
        // If not a Meta-box section than bail
        if($folder!= 'meta-boxes')
        {
            return $data;
        }
    
        // Allow Piklist to read our custom comment block attribute: "Hide for Template", and set it to hide_for_template
        $data['hide_for_template'] = 'Hide for Template';
    
        return $data;
    }
    
    add_filter('piklist_part_process_callback', 'my_hide_for_template', 10, 2);
    function my_hide_for_template($data, $type)
    {
        global $post;
    
        // If not a meta box than bail
        if($type != 'meta-boxes')
        {
            return $data;
        }
    
        // Check if any page template is set in the comment block
        if (!empty($data['data']['hide_for_template']))
        {
            // Get the active page template
            $active_template = pathinfo(get_page_template_slug($post->ID), PATHINFO_FILENAME);
    
            // Is there a page template set for this page?
            if(!empty($active_template))
            {
                // Does the active page template match what we want to hide?
                if (strpos($data['data']['hide_for_template'], $active_template) !== false)
                {
                    // Change meta-box access to user role: no-role
                    $data['role'] = 'no-role';
                }
            }
        }
        return $data;
    }
    
    /* ===== Comment Block in meta-boxes folder ===== */
    /*
    Title: Right Bar Section
    Description: Customized right bar section
    Post Type: page, promo
    Hide for Template: page-home
    Order: 3
    */
    
    in reply to: Hiding Meta Box for Specific Template #8373
    noobie
    Participant

    Dear Steve

    Do you have any other alternatives to resolve this?

Viewing 15 posts - 1 through 15 (of 19 total)