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
// For Admin 4months orther 2months | |
add_filter( 'auth_cookie_expiration', function ( $time, $user_id ) { | |
$user = new WP_User( $user_id ); | |
if ( ! empty ( $user->roles ) && in_array( 'administrator', $user->roles, true ) ) { | |
return MONTH_IN_SECONDS * 4; | |
} | |
return MONTH_IN_SECONDS * 2; | |
}, 99, 2 ); |
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
add_filter( 'template_include', function ( $template ) { | |
if ( is_singular( 'POST_TYPE_NAME' ) ) { | |
$term = get_the_terms( null, 'TAXONOMY_NAME' ); | |
$new_template = locate_template( array( 'TEMPLATE_NAME.php' ) ); | |
if ( isset( $term[0]->slug ) && $term[0]->slug == 'TERM_NAME' && '' != $new_template ) { | |
return $new_template; | |
} | |
} | |
return $template; |
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
/* | |
* Add Admin Hidden Page. | |
*/ | |
add_action( 'admin_menu', function () { | |
add_submenu_page( | |
'', | |
__( 'Trade License Image', 'text-domain' ), | |
__( 'Trade License Image', 'text-domain' ), | |
'manage_options', | |
'trade-license-image', |
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 | |
/* | |
* Plugin Name: WordPress.com Watermark Image Uploads | |
* Author: Alex Mills | |
* Author URI: http://automattic.com/ | |
*/ | |
class WPcom_Watermark_Uploads { | |
public $watermark; |
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
add_action( 'wp', function () { | |
is_admin() or switch_to_locale( 'en_US' ); | |
} ); |
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
/* | |
* Bulk Add Term Meta | |
*/ | |
function theme_create_term_meta( $term_id, $tt_id, $taxonomy ) { | |
if ( $taxonomy == 'rtcl_category' ) { | |
$types = array( 'sell', 'buy', 'rent' ); | |
if ( ! empty( $types ) ) { | |
foreach ( $types as $type ) { | |
add_term_meta( $term_id, '_rtcl_types', $type ); | |
} |
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
/* | |
* Register jQuery Script | |
*/ | |
function wp98_theme_jquery_scripts() { | |
wp_deregister_script( 'jquery' ); | |
wp_enqueue_script( 'jquery', '//code.jquery.com/jquery-1.11.0.min.js', false, '1.11', true ); | |
wp_deregister_script( 'jquery-migrate' ); | |
wp_enqueue_script( 'jquery-migrate', '//code.jquery.com/jquery-migrate-1.2.1.min.js', array( 'jquery' ), '1.2.1', true ); | |
} |
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
/* | |
* WP Blocks Color Palettes | |
*/ | |
function aa_theme_block_color_palette() { | |
add_theme_support( 'editor-color-palette', array( | |
array( | |
'name' => 'Primary', | |
'slug' => 'primary', | |
'color' => '#478abd', | |
), |
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
/** | |
* Optimize WooCommerce Scripts | |
* Updated for WooCommerce 2.0+ | |
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
*/ | |
function customizable_blogily_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); | |
//first check that woo exists to prevent fatal errors |
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
var mainMenu = document.querySelector( '#menu-primary-navigation' ); | |
document.querySelector( '.mainMenuToggler' ).addEventListener( 'click', function ( event ) { | |
event.preventDefault(); | |
/** Slide down. */ | |
if ( !mainMenu.classList.contains( 'active' ) ) { | |
/** Show the mainMenu. */ | |
mainMenu.classList.add( 'active' ); | |
mainMenu.style.height = "auto"; | |