mi-ca
Forum Replies Created
-
Forum: Plugins
In reply to: [Gutenberg] Customize Navigation Block Hamgurger IconThanks @sacredclown !
I had an issue with the regex because I had a “social icons block” in my navigation and thepreg_replace
also replace the social nav icons
So I change the 2 lines icon by 3 lines in the editor an modify the code like this [gist]<?php function custom_burger_svg_icon_render_block_core_navigation (string $block_content, array $block){ if ($block['blockName'] === 'core/navigation' && !is_admin() && !wp_is_json_request()) { // replace $svg content with your burger icon > this one was made by ngamlerdlek.design https://thenounproject.com/icon/burger-1126774/ $svg='<svg id="burger" xmlns="https://www.w3.org/2000/svg" with="64" height="64" viewBox="0 0 128 128"><path d="M11.81 88.57c0 8.08 5.68 14.62 12.56 14.62h80.15c6.88 0 12.56-6.54 12.56-14.62v-2.92H11.81v2.92Zm52.63-64.15c-29.06 0-52.63 19.44-52.63 43.17h105.25c-.17-23.91-23.56-43.17-52.62-43.17Zm55.03 47.64H9.23c-2.4 0-4.47 2.06-4.47 4.47S6.82 81 9.23 81h110.24c2.4 0 4.47-2.06 4.47-4.47 0-2.41-1.89-4.47-4.47-4.47Z"/></svg>'; // Replace the existing burger icons 3 lines burger (you have to change the 2 lines to 3 lines icon in wp-nav block) in the block content with the custom SVG return preg_replace('/\<svg width="24" height="24" xmlns="http:\/\/www.w3.org\/2000\/svg" viewBox="0 0 24 24"\>\<path d="M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z" \/\>\<\/svg\>/', $svg, $block_content); } return $block_content; } // Hook the custom function to the 'render_block' filter add_filter('render_block', 'custom_burger_svg_icon_render_block_core_navigation', null, 2);
insert in
functions.php
file in your themeForum: Developing with WordPress
In reply to: php warning – wp_list_pluck, wp-list-utilI had the same issues on several wp instance.
For me the issue came from loop on custom
WP_Query
with$args('fields' => 'ids')
WP cannot make a traditionnal
while $the_query->have_posts()
loop on a$args('fields' => 'ids')
resultsSo 2 ways to fix this notice :
1) remove the$args('fields' => 'ids')
or
2) replace thewhile
with aforeach
`while ( $the_query->have_posts() ) : $the_query->the_post();
//do stuff with get_the_ID();
endwhile;`
byforeach($the_query->posts as $post_id): // replace get_the_ID() by $post_id endforeach;
Ok Thanks
I set to keep log for 1 day. b u t …
Is there a way to clean those 57’000 entries in phpmyadmin ?- This reply was modified 7 years, 3 months ago by mi-ca.