Insert menu into theme location depending on user logged in/out status

Okay, figured it out! I’ve amended my theme function as follows: add_filter( ‘wp_nav_menu_items’, ‘add_loginout_link’, 10, 2 ); function add_loginout_link( $items, $args ) { if (is_user_logged_in() && $args->theme_location == ‘top_navigation’) { $items .= wp_nav_menu( array(‘menu’ => ‘menu-logged-in’, ‘container’ => ”, ‘echo’ => false, ‘items_wrap’ => ‘%3$s’) ); } elseif (!is_user_logged_in() && $args->theme_location == ‘top_navigation’) { $items … Read more

Create new product with woocommerce REST API with javascript (clientside)?

If you’re using SSL (HTTPS URL) you don’t need to use oauth1.0 with oauth signature and everything. All you need to do is pass in the consumer_key and consumer_secret in the url https://localhost/wpShop/wc-api/v2/products?consumer_key=ck_1111111111122123&consumer_secret=cs_232332322233232 That’s it! However, if your URL is NOT SSL, then you have to go to the trouble of creating an HMAC-SHA1 keys … Read more

Woocommerce products shortcode specific order

function woo_products( $atts ) { global $post; $product_Out=””; $atts = shortcode_atts( array( ‘product_ids’ => ”,// your product id goes here ), $atts, ‘bartag’ ); $pro_ids = explode(“,”, $atts[‘product_ids’]); foreach ($pro_ids as $key => $values) { $product_obj = $product = wc_get_product( $values ); //call your html and data in $product out variable $product_Out .= ‘<div class=”product_name”>’.$values.'</div>’; … Read more