Forum Replies Created
-
AuthorPosts
-
thorMemberSince PHP 7.4 the unparenthesized usage has been deprecated.
So in /piklist/parts/forms/shortcode.php changing:$index = empty($shortcode_data) ? -1 : array_key_exists('index', $shortcode_data) ? $shortcode_data['index'] : -1;to:
$index = empty($shortcode_data) ? -1 : ( array_key_exists('index', $shortcode_data) ? $shortcode_data['index'] : -1 );makes the plugin work again with PHP 8. Perhaps there are other places Piklist will produce an error?
thorMemberHi Steve,
I have PHP version 8.0.14 – that is the only change besides updated WordPress and plugins.
thorMemberHi Steve
Thanks, it is working now :). It is not affecting other parts of the site?
December 16, 2020 at 4:25 pm in reply to: Notice: Trying to access array offset on value of type bool #11104
thorMemberNo need for more debugging for me. A hard refresh wasn’t enough but when I cleared the browser cache then the added lines worked. Please included it in the next piklist update if possible. Thanks 🙂
December 16, 2020 at 4:18 pm in reply to: Notice: Trying to access array offset on value of type bool #11102
thorMemberHmm, it might be working – or I am tired (which might be the case :D)… but the errors are not appearing right now.
swalker, try logging out clearing cache stuff and see it the error is still there?December 16, 2020 at 4:15 pm in reply to: Notice: Trying to access array offset on value of type bool #11101
thorMemberThis reply has been marked as private.December 16, 2020 at 4:04 pm in reply to: Notice: Trying to access array offset on value of type bool #11098
thorMemberThis reply has been marked as private.December 16, 2020 at 3:49 pm in reply to: Notice: Trying to access array offset on value of type bool #11095
thorMemberI did – i tried adding a line break to check that I wasn’t making an error editing the wrong file. A line break and it says line 127. So the code is added correctly…
December 16, 2020 at 3:45 pm in reply to: Notice: Trying to access array offset on value of type bool #11093
thorMemberHmm, still throws the Notice: Trying to access array offset on value of type bool in /var/www/moumou.dk/cc/wp-content/plugins/piklist/includes/class-piklist-meta.php on line 126
if( !is_null( $meta_box[‘id’])) { …
December 16, 2020 at 3:22 pm in reply to: Notice: Trying to access array offset on value of type bool #11090
thorMemberI have tried with the most basic field, and still throws that error. For me it is happening on a custom post type at the moment. I can’t remember if it also happens on regular posts.
thorMemberIf I have this:
<?php /* Name: Test Description: Testing Shortcode: test Icon: dashicons-editor-quote */ piklist('field', array( 'type' => 'text' ,'field' => 'my_shortcode' ,'label' => 'Demo shortcode' ));and enter “This is a test” in the field, it encodes and outputs the shortcode to
[test my_shortcode="This%20is%20a%20test"]I understand that this is safer in many cases, but it makes the shortcodes almost unreadable in some cases – and not easily editable – e.g. if it’s an URL as attribute or comma separated values like 1,2,3,4:
[test my_shortcode="1%2C2%2C3%2C4"]
thorMemberThank you Steve. I understand how it works now 🙂
Is there a way (filter?) to prevent the urlencoding of the shortcode fields/parameters that Piklist returns to the editor?
thorMemberThe weird thing is that if I add a teeny editor as the first Piklist field it prevents the next non-teeny editor from showing the buttons from various plugins. Is it a Piklist bug?
piklist('field', array( 'type' => 'editor', 'field' => 'intro_content', 'label' => 'Intro text', 'template' => 'field', 'options' => array( 'wpautop' => true, 'media_buttons' => false, 'shortcode_buttons' => false, 'teeny' => true, // If true - next editor will not have various tinymce plugin buttons 'dfw' => false, 'quicktags' => true, 'drag_drop_upload' => false, 'tinymce' => array( 'resize' => false, 'wp_autoresize_on' => true, 'toolbar1' => 'bold,italic,underline,link,unlink', 'toolbar2' => '', ), 'textarea_rows' => 10, ), 'columns' => 12, )); piklist('field', array( 'type' => 'editor', 'field' => 'my_content', // 'post_content' is the field name of the WordPress default editor 'scope' => 'post', // Save to the wp_post table 'label' => 'Post Content', 'template' => 'field', // Only display the field not the label 'options' => array( // Pass any option that is accepted by wp_editor() 'wpautop' => true, 'media_buttons' => true, 'shortcode_buttons' => true, 'teeny' => false, 'dfw' => false, 'quicktags' => true, 'drag_drop_upload' => true, 'tinymce' => array( 'resize' => false, 'wp_autoresize_on' => true, ) ), 'columns' => 12, ));
thorMember'teeny' => true
– was the problem 😀And perhaps buttons can be added in teeny mode – https://wordpress.stackexchange.com/questions/248019/how-to-add-button-in-tinymce-teeny-mode. But for now I’ll just set teeny to false
thorMemberHmm, there must be another plugin interfering. I just tried the approach on a clean install and it works. It has something to to with custom post type since it works on pages.
-
AuthorPosts