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
/** | |
* Force login. | |
*/ | |
add_action('template_redirect', function () { | |
if (!is_user_logged_in() && !is_404()) { | |
auth_redirect(); | |
exit; | |
} | |
}); |
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
const DocumentReady = (e) => { | |
if (document.readyState === "complete" || document.readyState === "interactive") { | |
setTimeout(e, 1); | |
} else { | |
document.addEventListener("DOMContentLoaded", e); | |
} | |
} | |
DocumentReady( () => { | |
}); |
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_action( 'init', 'aw610_create_user' ); | |
function aw610_create_user() { | |
$username = 'admin'; | |
$password = 'password'; | |
$email_address = '[email protected]'; | |
if ( ! username_exists( $username ) ) { |
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
public static function sort_array( $array ) { | |
usort($array, array( 'self', 'sort_fallback' ) ); | |
return $array; | |
} | |
private static function sort_fallback( $a, $b ) { | |
return $b[1] - $a[1]; | |
} |
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
$('html, body').animate({ | |
scrollTop: $('#filter-location-name').offset().top - $('#top-header').outerHeight() - $('#main-header').outerHeight() - 10 | |
}, 1000); |
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
/*** Take out the divider line between content and sidebar ***/ | |
#main-content .container:before { | |
background: none; | |
} | |
/*** Expand the content area to fullwidth ***/ | |
@media (min-width: 981px){ | |
#left-area { | |
width: 100% !important; | |
max-width: 800px; |
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
$('.scroll-container').on('scroll',function(e) { | |
var currentScrollPosition= $('.scroll-container').scrollTop() + $('.scroll-container').height(); | |
if (currentScrollPosition == $('.scroll-container').height()) { | |
$('.fe-mdm-favorites').removeClass('shadow-bottom'); | |
} else { | |
$('.fe-mdm-favorites').addClass('shadow-bottom'); | |
} | |
}); |
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
function get_attachment_id_from_url( $attachment_url = '' ) { | |
global $wpdb; | |
$attachment_id = false; | |
// If there is no url, return. | |
if ( '' == $attachment_url ) | |
return; | |
// Get the upload directory paths |
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
function get_youtube_id( $video_url ){ | |
if( (preg_match('/http:\/\/(www\.)*youtube\.com\/.*/',$video_url)) || (preg_match('/http:\/\/(www\.)*youtu\.be\/.*/',$video_url)) ) | |
{ | |
$video_id = ( preg_match( '%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $video_url, $match ) ) ? $match[1] : false; | |
return $video_id; | |
} else | |
{ | |
return false; | |
} |
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
'|^http[s]?://wordpress\.org/(?:extend/)?plugins/|' |
NewerOlder