How do I have WordPress use the tag for generated menus?

If you’re just trying to replace <ul…> and </ul> with <menu…> and </menu> in the generated HTML, you can use the wp_nav_menu filter: add_filter( ‘wp_nav_menu’, ‘wpse_426932_menu_fix’ ); /** * Fixes the menu HTML to use <menu> instead of <ul>. * * @param string $html The menu HTML. * @return string The fixed menu HTML. */ … Read more

How do I read a JSON file and access its properties?

If you want to loop the menus from the json, then you need to use the data attribute where the menus actually are. Also you may want to use the current iteration $menu slug in the get_term_by() call, unless you specifically want to check for existance of “Primary” menu on each iteration. If that is … Read more

dashboard_activity hook

Using the dashboard_recent_posts_query_args filter, you can add your custom post types to the query args, and they’ll be included (untested): add_filter( ‘dashboard_recent_posts_query_args’, static function ( $args ) { if ( ! is_array( $args[‘post_type’] ) ) { $args[‘post_type’] = array( $args[‘post_type’] ); } $args[‘post_type’][] = ‘cpt’; return $args; } );

Unable to remove action from parent theme via child theme

The child theme’s functions.php is loaded before the parent theme’s functions.php: Unlike templates and patterns, the functions.php file of a child theme does not override the functions.php file in the parent theme. In fact, they are both loaded, with the child being loaded immediately before the parent. Source: https://developer.wordpress.org/themes/advanced-topics/child-themes/#using-functions-php This means that when the child … Read more

How to render HTML content using the Interactivity API?

Rather than binding text with a directive, you could bind a callback with data-wp-watch that sets the inner HTML of the div when it runs: <div data-wp-watch=”callbacks.renderContent”></div> callbacks: { renderContent() { const context = getContext(); const element = getElement(); element.ref.innerHTML = context.randomPost.content.rendered; }, }, Since the callback uses context.randomPost.content.rendered, it should run any time that … Read more

Filtering the Navigation Block

First I was about to suggest you’d try replacing the render_callback of the core/navigation block. The custom rendering callback would have returned a class extending the WP_Navigation_Block_Renderer class. E.g. add_filter( ‘block_type_metadata_settings’, ‘wpse_426956_replace_core_nav_block_renderer’, 10, 2 ); function wpse_426956_replace_core_nav_block_renderer( array $settings, array $metadata ): array { if ( ‘core/navigation’ === $metadata[‘name’] ) { $settings[‘render_callback’] = ‘wpse_426956_my_core_nav_block_renderer’; } … Read more

$wpdb->get_results() into foreach() returns always the word “Array” on top of the list . How to get rid of?

I’m not sure why you are getting errors but I can show you haw to defensively find and react to them. This is your code $rows = $wpdb->get_results($wpdb->prepare(“SELECT `rul_value` FROM ” . _ROLES_ . ” WHERE `rul_type` = %s AND `rul_value` LIKE %s”, ‘role’, ‘%intera%’)); foreach($rows as $row) { $singleParts .= $row->rul_value . “\n”; } … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş