new to javascript – using in instead of functions.php, not loading correctly

Start by putting your JS in an appropriate .js file in your theme directory. Use the wp_enqueue_scripts hook (this is where you will enqueue/load any of your custom javascripts). Within that hook, use wp_enqueue_script() to load your script(s). Example: add_action( ‘wp_enqueue_scripts’, ‘enqueue_my_stuff’ ); function enqueue_my_stuff () { wp_enqueue_script(‘slug_for_your_script’ , get_template_directory_uri() . ‘/path/to/yourscripts.js’, array(‘jquery’) ); }

Image width issue in IE [closed]

The issue was related to width: 100%; being applied by WordPress to all images. The code below fixes this issue – i applied this only to IE 8 and lower, as these are the browsers that have issues with the code. img.size-full, img.size-large, img.header-image, img.wp-post-image { max-width: none !important; }

How to assign a div class to a echo function [closed]

This is not a specific WordPress question, is a topic in php coding. You can add html markup inside the echo in your function, like the follow example: function show_today_date() { echo ‘<div class=”example”>’ . date( get_option( ‘date_format’ ) ) . ‘</div>’; } add_shortcode( ‘showtodaydate’, ‘show_today_date’ );

Custom shortcode not being included in content paragraph [duplicate]

The ‘contact’ function should return a string instead of echoing. So the above, should look like: function contact() { $contact = get_field(‘contact’,options); return $contact; } add_shortcode(‘contact’, ‘contact’); Shortcodes are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output). See … Read more