How to display an image before title text in menu items

You are almost there, see comments in code below… function wp3456789_wp_nav_menu_objects( $items, $args ) { foreach( $items as &$item ) { $image = get_field(‘icon’, $item); if( $image ) { // Your original code which appends html string to current $item->title //$item->title .= ‘<span class=”inline-img’ . $item->class . ‘”><img class=”style-svg” src=”‘ . $image[‘url’] . ‘” width=”” … Read more

Why should I use get_template_directory() when include files?

get_template_directory() can be filtered. This can be useful when a plugin wants to interact with your theme, for example when you want to write custom plugins to extend the theme without changing it. For example: add_filter( ‘template_directory’, function( $template_dir, $template, $theme_root ) { if ( some_condition( $theme_root ) ) { return plugin_dir_path( __FILE__ ) . … Read more

Add version # to wp_register_style function

I think the issue here is how to read the documentation. The bold code at the top shows how the function is declared by WordPress, not how to use it. Let’s break it down: wp_register_style( string $handle, string|bool $src, string[] $deps = array(), string|bool|null $ver = false, string $media=”all” ) Every possible variable has it’s … Read more