Please Use Below code
<?php
$addcats = array();
ob_start();
require 'custom_menu_addon.php';
$addCats = ob_get_clean();
wp_nav_menu(array(
'theme_location' => 'menu-1',
'menu_id' => 'primary-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s<div class="my-div">' . $addCats . '</div></ul>'
));
I’ve edited this answer after some research into the usage of this object array and put it in context with my code, works well on the site đŸ™‚
Related Posts:
- How to use nonce with front end submission form?
- Autoloading in Child Theme
- How to loop through JSON data in wordpress WP REST API
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- WordPress Customizer: How can you have multiple active callbacks on one control?
- Looking for a better way to handle an ajax script that pulls in post data on click
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- wordpress custom endpoint multiple params
- Enable errors PHP WordPress 5.2
- How to set status codes such as 401 and 403?
- Minify HTML, CSS, JS with PHPWee?
- Show Custom Taxonomy Title
- WordPress widget/sidebar dividers?
- Add custom php database code above
- Help with some php math in WordPress
- Latest post in a specific menu
- WordPress not reflecting changed of the database
- Woocommerce related product text
- Is it better to store images and other files in the root directory or the theme directory
- How to get post permalink url without a href
- Convert the_permalink() function output into string
- Fatal error: Uncaught Error: Call to undefined function get_header() [closed]
- get_current_site() is undefined
- Incrementing PHP variable onclick to display posts by month
- Use variable in SQL statement
- writing an unique php function to be used on my website
- Get options from database using php class
- Problem in replacing the_content with the_excerpt()
- Need to add a post’s featured image to a section on the frontpage
- Output product category link from WP_Query
- Adding onload to body for certain pages
- Variation prices breakdown only for single product page
- Change wordpress’ database data using ajax – how to get current user id?
- How to block specific user id in custom login form?
- Passing a value from an input field to a php function in WordPress?
- Store user form submitted information in post type
- Block that renders html saved in a php file
- WordPress files break if I edit them, but adding a closing PHP tag fixes it
- $_GET[‘title’] in WordPress
- Can’t update or install plugins in WordPress, php unidentified index
- Offset with ajax load more posts duplicates
- How to detect if a revision was made by woocommerce or wordpress?
- WP Redirect with user nickname/username
- If else statement based on referral URL
- Hide sharing box and author box with a metabox on WordPress
- WordPress Website Featured Image Replacement Issue
- 500 error when using wp_upload_dir() [closed]
- Using Excel formula in PHP. Use ^ symbol [closed]
- Correct way to perform a GET to another PHP file hosted on wordpress
- Understanding responsive imagery
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- Cannot install plugins or themes on new WordPress installation at Cloudways
- Custom WP LIST Table filter
- WordPress online courses system
- How to align buttons properly [closed]
- index.php file keeps redirecting to a non-existent index.html file?
- How to pass parameter to another url?
- HTTP 500 Error after Creating Shortcode
- Show button in header when product custom field is not empty
- Why a class property becomes empty?
- how to goto specific page number including title with permalink
- get_the_term_list give me a whitespace
- Hide category by tag
- understanding wp_next_scheduled
- WordPress 6.1.1 UTF8 Slug Limit Increase
- WordPress directories not writable after PHP version upgrade
- How do I unset category from a product in wordpress by code
- How to change wp-admin and wp-login urls
- How to get meta box labels?
- get_query_vars always retruns empty value
- How to group by column a and sum column b and c in a php array
- Convert custom field date format to “WordPress default”
- Woocommerce Convert existing order to the cart
- Execute function when I click button
- links Slick jS library using wp_enqueue_scripts not pulling
- How to run site locally after downloading database
- How to change shipping method title based on cart amount?
- Redirect posts to post editor page based on query string
- How do I stylize selected comments?
- Displaying generated HTML within a WordPress site
- WordPress PHP8 Critical Error in class-wp-widget.php
- How to get the last date updated of postmeta?
- How to add SKU and remove product title from WooCommerce url?
- php 8 compability admin interface
- How can I make below code to show grouping by country ranks in same div, example if in second loop rank 2nd must be show in same 2nd class div
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- Load style and script for custom post type metabox
- Permissions error when I use my plugin to delete comments in the front-end
- Product Search in search.php
- Background Tasks in a WP Cronjob?
- How to execute a shortcode within a custom field?
- using custom pages for myaccount in woocommerce
- Putting form result in my database
- SQL – How to echo out inside of where statement
- How to create different templates for woocommerce single-product.php?
- How can I update a value of a field depending on outside source?
- Restricting access to a file for everyone except logged in users
- WordPress Block Editor Gutenberg running code inside ! is_admin()
- Tags being Inserted in html from plugin PHP not passing through the_content