This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // This is a work in progress, but it works fine | |
| // Requires custom functions & libraries not present in the script (eg. Swiper) | |
| // Adapted from my Visual Composer custom module (same purpose) https://gist.github.com/Jany-M/7a94e2edc04969dcded247ff99a15088 | |
| // Doesn't play well with WPML, for now | |
| function shambix_shortcode_mu_posts($atts, $content = null ) { | |
| // Let's compare parameters with defaults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // There's also a standalone version, no Visual Composer required, purely as a shortcode here https://gist.github.com/Jany-M/d3014a7039c884a8bbd8e8271cfcd982 | |
| if( class_exists( 'WPBakeryShortCode' ) && !class_exists( 'vcMUloop' ) ) { | |
| class vcMUloop extends WPBakeryShortCode { | |
| function __construct() { | |
| add_action( 'init', array( $this, 'vc_multisite_mapping' ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add SKU next to variation ID | |
| function display_sku_next_to_var_ids() { | |
| ?> | |
| <script type="text/javascript"> | |
| jQuery(function($) { | |
| "use strict"; | |
| $(document).on('woocommerce_variations_loaded', function(event) { | |
| var id = -1; | |
| $('.woocommerce_variation.wc-metabox').each( function(index, elem) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Grab the first paragraph, show it where you need it, then take the rest of the content and remove the first paragraph and show it elsewhere | |
| // The script uses WordPress functions/content but can be used in any PHP script, just replace the WP functions | |
| // First Paragraph | |
| global $post; | |
| $p1 = wpautop( $post->post_content ); | |
| $p1 = substr( $p1, 0, strpos( $p1, '</p>' ) + 4 ); | |
| //$p1 = strip_tags($p1, '<a><strong><em><h3><h2><i>'); // in case you need to remove some tags, add the ones you want to KEEP here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.grid').isotope({ | |
| itemSelector: '.grid-item', | |
| //percentPosition: true, | |
| masonry: { | |
| columnWidth: 100 | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Place the handles somewhere convenient | |
| global $scripts_to_defer, $scripts_to_async, $scripts_origin; | |
| $scripts_to_defer = array('fancybox_js', 'bootstrap_js'); | |
| $scripts_to_async = array('fontawesome_js'); | |
| $scripts_origin = array('fontawesome_js'); | |
| // Put this in functions.php | |
| function add_defer_attribute($tag, $handle) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* -------------------------------------------------------------------------------- | |
| * | |
| * JS stand-alone (CSS not included - Get it here https://pastebin.com/uNKPdMVj) | |
| * | |
| -------------------------------------------------------------------------------- */ | |
| ?> | |
| <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # etc/httpd/conf.d/expires.conf | |
| # https://support.plesk.com/hc/en-us/articles/115001711985-How-to-enable-leverage-browser-caching-in-Plesk | |
| # https://support.plesk.com/hc/en-us/articles/213380049-How-to-enable-gzip-compression-on-nginx-on-Plesk-server | |
| LoadModule expires_module modules/mod_expires.so | |
| ExpiresActive on | |
| ExpiresByType application/vnd.ms-fontobject "access plus 1 year" | |
| ExpiresByType application/x-font-ttf "access plus 1 year" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* ------------------------------------------------------------------------------------------------ | |
| * | |
| * METHOD 1 | |
| * | |
| -------------------------------------------------------------------------------------------------- */ | |
| // Customize WooCommerce Attributes (method 1 - no swatches/plugins) | |
| function wc_custom_attr( $product ) { |