WordPress 3.5 custom media upload for your theme options

Your going about it in a way that was unintended. Your javascript code should probably look something like this: $(‘.custom_media_upload’).click(function(e) { e.preventDefault(); var custom_uploader = wp.media({ title: ‘Custom Title’, button: { text: ‘Custom Button Text’ }, multiple: false // Set this to true to allow multiple files to be selected }) .on(‘select’, function() { var … Read more

Get cart item name, quantity all details woocommerce

Try this : <?php global $woocommerce; $items = $woocommerce->cart->get_cart(); foreach($items as $item => $values) { $_product = wc_get_product( $values[‘data’]->get_id()); echo “<b>”.$_product->get_title().'</b> <br> Quantity: ‘.$values[‘quantity’].'<br>’; $price = get_post_meta($values[‘product_id’] , ‘_price’, true); echo ” Price: “.$price.”<br>”; } ?> To get Product Image and Regular & Sale Price: <?php global $woocommerce; $items = $woocommerce->cart->get_cart(); foreach($items as $item => … Read more

How to add Class in using wp_nav_menu() in WordPress?

No need to create custom walker. Just use additional argument and set filter for nav_menu_css_class. For example: $args = array( ‘container’ => ”, ‘theme_location’=> ‘your-theme-loc’, ‘depth’ => 1, ‘fallback_cb’ => false, ‘add_li_class’ => ‘your-class-name1 your-class-name-2′ ); wp_nav_menu($args); Notice the new ‘add_li_class’ argument. And set the filter on functions.php function add_additional_class_on_li($classes, $item, $args) { if(isset($args->add_li_class)) { … Read more

VS Code highlighted all my wordpress function name

You have to add “wordpress” to the intelephense.stubs array setting in your VS Code settings file. This array should probably also have many other stubs listed as well. For example: (“wordpress” is at the bottom) // VS Code settings.json { // … other settings here … “intelephense.files.maxSize”: 3000000, “intelephense.stubs”: [ “apache”, “bcmath”, “bz2”, “calendar”, “com_dotnet”, … Read more