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

Dynamically populate the menu when a new category is created

yes, of course it is possible to do. Here is the code to get all the categories on a page load, this code is prepared to go until the 3rd category generation. $cats = get_categories( array(‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true) ); foreach ($cats as $key => $cat): if ($cat->parent == 0): echo $cat->name; foreach … Read more

How to link current logged-in user to their author page via URL (Beginner)

UPDATE As per the comment, here is the updated solution. Note: Before copy pasting, don’t forget to change somePrefix with any other prefix to avoid conflict with any other shortcodes. Step 1: Make sure you have this filter in functions.php (If not, copy paste it there) add_filter(‘wp_nav_menu_items’, ‘do_shortcode’); Step 2: Use this snippet to return … Read more