This file contains 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
// Load Child Theme Specific JS | |
function load_child_js_files() { | |
wp_register_script('filename', get_stylesheet_directory_uri() . '/js/filename.js', array('jquery'), '', true); | |
wp_enqueue_script('filename'); | |
} | |
add_action('wp_enqueue_scripts', 'load_child_js_files', 99); |
This file contains 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
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
$('.video-modal').magnificPopup({ | |
type: 'iframe', | |
mainClass: 'mfp-fade', | |
removalDelay: 160, | |
preloader: true, | |
fixedContentPos: false | |
}); | |
}); |
This file contains 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
// -- WooCommmerce Mods | |
// Bypass View Cart Page in WooCommerce | |
function ultimate_redirect_to_checkout() { | |
global $woocommerce; | |
// Remove the default `Added to cart` message | |
wc_clear_notices(); | |
return $woocommerce->cart->get_checkout_url(); | |
} | |
add_filter ( 'add_to_cart_redirect', 'ultimate_redirect_to_checkout' ); |
This file contains 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
/* Add Custom Taxonomy Shortcode | |
/* | |
* Example: [term-list term="taxonomy term here"] | |
*/ | |
function custom_taxonomy_list_shortcode( $atts ) { | |
$atts = shortcode_atts( array( | |
'term' => 'location', | |
), $atts ); |
This file contains 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
<div id="favorites-post-container"> | |
<?php | |
$favorites = get_user_favorites(); | |
if ( $favorites ) : // This is important: if an empty array is passed into the WP_Query parameters, all posts will be returned | |
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1; // If you want to include pagination | |
$favorites_query = new WP_Query(array( | |
'post_type' => 'post', // If you have multiple post types, pass an array | |
'posts_per_page' => -1, | |
'ignore_sticky_posts' => true, | |
'post__in' => $favorites, |
This file contains 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
add_action( 'pmxi_saved_post', 'post_saved', 10, 1 ); | |
function post_saved( $id ) { | |
global $wpdb; | |
$pass = get_user_meta( $id, 'xfer_user_pass', true ); | |
$wpdb->query( $wpdb->prepare( | |
" | |
UPDATE `wp_users` | |
SET `user_pass` = %s | |
WHERE `ID` = %d |
This file contains 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 | |
/** | |
* Adds new shortcode "myprefix_say_hello" and registers it to | |
* the Visual Composer plugin | |
* | |
*/ | |
if ( ! class_exists( 'MyPrefix_Say_Hello_Shortcode' ) ) { | |
class MyPrefix_Say_Hello_Shortcode { |
This file contains 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
// Removes the Yoast Metabox for Roles other then Admins | |
// Returns true if user has specific role | |
function check_user_role( $role, $user_id = null ) { | |
if ( is_numeric( $user_id ) ) | |
$user = get_userdata( $user_id ); | |
else | |
$user = wp_get_current_user(); | |
if ( empty( $user ) ) | |
return false; | |
return in_array( $role, (array) $user->roles ); |
This file contains 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
// Remove Taxonomy Slug | |
add_filter( 'term_link', 'remove_tax_slug_link', 10, 3 ); | |
function remove_tax_slug_link( $link, $term, $taxonomy ) { | |
if ( $taxonomy !== 'your-taxonomy-name' ) | |
return $link; | |
return str_replace( 'your-taxonomy-name/', '', $link ); | |
} | |
add_action('init', 'custom_tax_rewrite_rule', 10, 0); |
This file contains 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
add_action( 'wp_enqueue_scripts', 'enqueue_cpt_script' ); | |
function enqueue_cpt_script() { | |
if ( 'cpt-type' === get_post_type() ) { | |
if ( wp_script_is( 'file.js', 'enqueued' ) ) { | |
return; | |
} else { | |
wp_register_script( 'file name', get_stylesheet_directory_uri() . '/js/file.js' ); | |
wp_enqueue_script( 'file name' ); | |
} | |
} |
OlderNewer