Easy Tabbed Navigation With jQuery

Easy Tabbed Navigation With jQuery

By OutsourcedContent — on December 10, 2017 Here is the HTML Markup <h4 class=”single-company-tab-wrapper hide-if-no-js”>   <a class=”single-company-tabs” href=”#info”>Info</a>   <a class=”single-company-tabs” href=”#contact”>Contact</a> </h4>   <div id=”info” class=”tab-content”>   <p>Content of info tab</p> </div>   <div id=”contact” class=”tab-content”>   <p>Content of contact tab</p> </div> And here is the jQuery jQuery( document ).ready( function($){   $(‘.tab-content’).hide(); // Hide all tabs first …

Full Width Responsive WordPress YouTube Embeds Automatically

Full Width Responsive WordPress YouTube Embeds Automatically

By OutsourcedContent — on January 12, 2018 Add this to the functions.php /** * Add Response code to video embeds in WordPress * * @refer  http://alxmedia.se/code/2013/10/make-wordpress-default-video-embeds-responsive/ */ function abl1035_alx_embed_html( $html ) {      return ‘<div class=”video-container”>’ . $html . ‘</div>’; } add_filter( ’embed_oembed_html’, ‘abl1035_alx_embed_html’, 10, 3 ); add_filter( ‘video_embed_html’, ‘abl1035_alx_embed_html’ ); // Jetpack Add this to…

Add Left And Right Swipe On Mobile For Bootstrap 4 Carousel

Add Left And Right Swipe On Mobile For Bootstrap 4 Carousel

By OutsourcedContent — on January 13, 2018 We are talking about carousel included in Bootstrap 4, you can see how to add one here. Add this to your JS file or load it on the footer // Thanks to Maaaaark – https://github.com/maaaaark/bcSwipe/blob/master/jquery.bcSwipe.min.js !function(t){t.fn.bcSwipe=function(e){var n={threshold:50};return e&&t.extend(n,e),this.each(function(){function e(t){1==t.touches.length&&(u=t.touches[0].pageX,c=!0,this.addEventListener(“touchmove”,o,!1))}function o(e){if(c){var o=e.touches[0].pageX,i=u-o;Math.abs(i)>=n.threshold&&(h(),t(this).carousel(i>0?”next”:”prev”))}}function h(){this.removeEventListener(“touchmove”,o),u=null,c=!1}var u,c=!1;”ontouchstart”in document.documentElement&&this.addEventListener(“touchstart”,e,!1)}),this}}(jQuery);   // Swipe functions…

Redirect User To Post If Search Results Return One Post

Redirect User To Post If Search Results Return One Post

Recently on a project, my client asked me to develop a system to redirect user to post if search results returns only one post. Although it’s fairly simple system to develop but I started searching on Google if someone has already tried to develop similar function. Fortunately WordPress developer Paul Underwood has shared a WordPress…

Unhooking Actions Hooked Inside PHP Classes With remove_action

Unhooking Actions Hooked Inside PHP Classes With remove_action

By OutsourcedContent — on April 13, 2018 Here is an example. The following snippet removes the action hooked from the SumoMe plugin – https://wordpress.org/plugins/sumome/ /** * Dequeue SumoMe inline script * * @author Arun Basil Lal */ function rocket_helper_dequeue_sumo_me_js() {      global $wp_plugin_sumome;   remove_action(‘admin_footer’, array( $wp_plugin_sumome, ‘append_admin_script_code’ ) ); } add_action( ‘admin_head’, ‘rocket_helper_dequeue_sumo_me_js’ ); $wp_plugin_sumome…

Read Plugin Version Of Any WordPress Plugin

Read Plugin Version Of Any WordPress Plugin

By OutsourcedContent — on April 19, 2018 Using the get_file_data() function. More efficient than using get_plugin_data() function. $plugin_data = get_file_data( WP_PLUGIN_DIR . ‘/plugin-folder-name-in-wp-content-plugins-folder/plugin-main-file.php’, array( ‘Version’ => ‘Version’ ) ); $plugin_data[‘Version’] will have the version. To read version from within the same plugin: $plugin_data = get_file_data( __FILE__, array( ‘Version’ => ‘Version’ ) ); Refer: https://wordpress.stackexchange.com/a/285644/90061 Pro…