Skip to content

Instantly share code, notes, and snippets.

View mlbd's full-sized avatar
🏠
Working from home

Mohammad Limon mlbd

🏠
Working from home
View GitHub Profile
function isMapScrolledIntoView(elem)
{
var $elem = $(elem);
var $window = $(window);
var docViewTop = $window.scrollTop();
var docViewBottom = docViewTop + $window.height();
var elemTop = $elem.offset().top;
var elemBottom = elemTop + $elem.height();
add_action('wp_head','wppu15_home_custom_remove_action',1);
function wppu15_home_custom_remove_action() {
if( is_front_page() || is_home() ) {
remove_action( 'wp_footer', 'wppu_awesome_option_script_init' );
remove_action( 'wp_enqueue_scripts', 'wppu_awesome_css_options_files' );
remove_action( 'wp_head', 'wppu_awesome_css_options_markup_frontedn' );
remove_action( 'wp_enqueue_scripts', 'wppu_pace_jquery_options_active_script_style' );
remove_action( 'wp_head', 'wppu_pace_style_add__frontend' );
remove_action( 'wp_head', 'wppu_pace_markup_add__frontend' );
add_action('wp_head','wppu15_archive_custom_remove_action',1);
function wppu15_archive_custom_remove_action() {
// please change product or service name if your post has different name
// this script will disable wppu preloader on your disable archive pages
if( is_post_type_archive( array('product', 'service') ) ) {
remove_action( 'wp_footer', 'wppu_awesome_option_script_init' );
remove_action( 'wp_enqueue_scripts', 'wppu_awesome_css_options_files' );
remove_action( 'wp_head', 'wppu_awesome_css_options_markup_frontedn' );
remove_action( 'wp_enqueue_scripts', 'wppu_pace_jquery_options_active_script_style' );
.move-items.container .inner-container {
margin-left: calc((-100vw + 100%) / 2);
margin-right: calc((-100vw + 100%) / 2);
padding-left: calc((100vw - 100%) / 2);
padding-right: calc((100vw - 100%) / 2);
}
// jQuery
$(window).trigger('resize');
// Javascript
window.dispatchEvent(new Event('resize'));
// Javascript support IE as well
var evt = window.document.createEvent('UIEvents');
evt.initUIEvent('resize', true, false, window, 0);
window.dispatchEvent(evt);
/*****
- This is a template used by 6 posts within a CPT
- Each post contains some text in the content editor and an ACF Gallery.
- Each image is tagged with category(ies) using Enhanced Media Library plugin.
- The categories used on each page are being echoed out to provide a means to filter the images.
- The lightbox being used is http://photoswipe.com
- The filter is done with http://isotope.com
- Included with the Isotope integration is https://github.com/desandro/imagesloaded
// jQuery
$(".image-container > img").each(function(i, img) {
$(img).css({
position: "relative",
left: ($(img).parent().width()/2) - ($(img).width()/2),
top: ($(img).parent().height()/2) - ($(img).height()/2),
});
});
<!-- html markup -->
@mlbd
mlbd / How to detect if a WordPress plugin is active.php
Created November 19, 2017 13:02 — forked from llgruff/How to detect if a WordPress plugin is active.php
A function you can use to check if plugin is active/loaded for your plugins/themes
<?php
/**
* Detect if a WordPress plugin is active
* A function you can use to check if plugin is active/loaded for your plugins/themes
* @link //gist.github.com/llgruff/c5666bfeded5de69b1aa424aa80cc14f
*/
// When coding plugins that rely on another one, like Private Content for bbPress or Visual Attributes for WooCommerce, you need to make if the WordPress Plugin is active to initialize your plugin routines or display a notice saying that the required plugin must be activated. In this tutorial we’ll see how to detect whether a certain plugin is active in a couple of ways.
## 1. Check whether a certain class or function or constant exists
<?php
$socials = $pixiefy_option['social_links'];
if ( (array) $socials && isset($socials) ) :
echo '<ul id="social-buttons">';
foreach ( (array) $socials as $key => $entry ) {
if ( isset( $entry['url'] ) ) {
$original_url= $entry['url'];