Visual Composer creating own shortcodes with vc_map() to return simple Image

Visual Composer adds the image ID to the generated shortcode. This gives you more flexibility with image sizes. You can use it like this: $imageSrc = wp_get_attachment_image_src($image_url, ‘thumbnail’); if( $imageSrc ) { echo ‘<img src=”‘ . $imageSrc[0] . ‘” />’; } The thumbnail param could be replaced by medium or another valid image size. The … Read more

Disable wp_is_mobile()

wp_is_mobile() does not have any filters or ways to override. What you’ll need to do is build a wrapper of your own around wp_is_mobile() and use that in your code where you’ve used wp_is_mobile(). Something like the following prototype could work for you. Ultimately a better option over the URL parameter might be to use … Read more

Scripts not loading when using the wp_enqueue_scripts action

get_stylesheet_uri() loads the main stylesheet of the theme. If you need to load additional stylesheets, you need to use get_template_directory_uri() for parent themes and get_stylesheet_directory_uri() for child themes. If you have stylesheet called custom.css in the root in a child theme, you will use get_stylesheet_directory_uri()’ . /custom.css’ You should also make sure that you have … Read more

How do I hook into the container of wp_nav_menu?

Solved it by setting container to false and then wrapping it manually. <nav class=”main_navigation”> <div class=”topper”> <a href=”https://wordpress.stackexchange.com/questions/203496/<?=get_home_url()?>” class=”intranet”>H</a> </div> <?php wp_nav_menu(array(‘container’=>false) ?> </nav>

Disabling visual editor on a specific post

I’ve tested the code you provided both WITH and WITHOUT the WP Editor plugin enabled and the “Visual” tab is suppressed in both cases. This means the user is forced into “Text” mode on post 416. To address your second request, I’ve modified the code to allow you to supply a list of posts that … Read more

hide shortcode using hooks

Instead of removing the shortcode, re-register it with a function that returns an empty string (or something that casts to an empty string). You can use the built in __return_empty_string. This will replace whatever the original callback was with something that just replaces the shortcode with nothing. // sometime after the first call to add_shortcode … Read more

New functions in separate directory — better, portable way

I’d say that the thing you’re looking for is having functions.php as a plugin. This makes it portable, regardless of the theme you are using. The most simple way is create a new file (something like my-woocommerce-functions.php) and start with the following: <?php /** * Plugin Name: My Custom WooCommerce Functions * Plugin URI: http://example.com … Read more