Forum Replies Created
-
AuthorPosts
-
noobieParticipantThis reply has been marked as private.
noobieParticipantThis reply has been marked as private.
noobieParticipantDear Steve
Noted with thanks.
noobieParticipantDear Steve
Any suggestions?
noobieParticipantDear 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 2669May I know what should I do to fix this?
noobieParticipantDear Steve
Thank you so much. It works now.
noobieParticipantDear Steve
May I check if you have received the theme file?
noobieParticipantDear Steve
I have sent you, the file.
Please have a look.
noobieParticipantDear Steve
Apologies, the metabox is still NOT showing.
noobieParticipantDear 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 */
noobieParticipantDear Steve
May I know how you got it working?
noobieParticipantDear Steve
Sorry for the trouble, I used the same codes from tutorial but is still not working.
Please advice.
noobieParticipantDear 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; }
noobieParticipantDear 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 */
noobieParticipantDear Steve
Do you have any other alternatives to resolve this?
-
AuthorPosts