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
# ---------------------------------------------------------------------- | |
# | Expires headers | | |
# ---------------------------------------------------------------------- | |
# Serve resources with far-future expires headers. | |
# | |
# (!) If you don't control versioning with filename-based | |
# cache busting, you should consider lowering the cache times | |
# to something like one week. | |
# |
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 | |
// Get T&C page (requires WC) | |
if ( function_exists('wc_get_page_id') ) { | |
$terms_page = wc_get_page_id( 'terms' ); | |
if ( $terms_page > 0 ) | |
echo '<a href="' . get_the_permalink( $terms_page ) . '">' . get_the_title( $terms_page ) . '</a>'; | |
} | |
if ( function_exists( 'the_privacy_policy_link' ) ) |
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 | |
/* | |
* Displays a Privacy Policy link in the footer. | |
* Requires WP 4.9.6 | |
*/ | |
function lightseek_privacy_policy() { | |
if ( function_exists( 'the_privacy_policy_link' ) ) | |
the_privacy_policy_link( '<div class="lightseek-pp">', '</div>'); |
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 | |
// Replace the values below with the field names configured in ACF. | |
function cs_dynamic_sidebar_params( $params ) { | |
// bail early if ACF is not active | |
if (!function_exists('get_field')) return $params; | |
// get widget vars | |
$widget_name = $params[0]['widget_name']; |
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 | |
function cs_login_link() { | |
// Bail early if we don't have WC. | |
if ( !function_exists('wc_get_cart_url') ) return; | |
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' ); | |
$myaccount_page_url = $myaccount_page_id ? get_permalink( $myaccount_page_id ) : NULL; | |
if ( !$myaccount_page_url ) return; |
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 | |
// Place in an action. | |
// Requires Font Awesome 5. | |
function cs_cart_icon() { | |
// Bail early if we don't have WC. | |
if ( !function_exists('wc_get_cart_url') ) return; | |
?> | |
<a class="cart-contents text-white" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View the shopping cart' ) ?>"> |
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 | |
/* | |
* Temporarily block access to the WordPress site. | |
*/ | |
function my_little_maintenace_mode() { | |
if ( !current_user_can( 'administrator' ) ) wp_die('Please <a href="' . wp_login_url() . '">log in</a> first.'); | |
} | |
add_action('get_header', 'my_little_maintenace_mode'); |
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
# | |
# Menus | |
# | |
# Note: Add '--porcelain' flag to output the ID of the added item | |
# Documentation | |
wp help menu | |
# List Menu Locations |
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
# This function passes up to 9 chained params to `wpcli` on docker in the current directory. | |
# I haven't figured out how to spread an undefined amount of parameters yet... | |
# Simply call "wp help", "wp post list" etc. | |
function wp($p1, $p2, $p3, $p4, $p5, $p6, $p7, $p8, $p9) { docker-compose run --rm wpcli $p1 $p2 $p3 $p4 $p5 $p6 $p7 $p8 $p9 } |