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
/** | |
* Adding alternative text for screen readers to pseudo elements. | |
* | |
* https://developer.mozilla.org/en-US/docs/Web/CSS/content#adding_an_image_with_alternative_text | |
**/ | |
.location { | |
&::before { | |
/* fallback content */ | |
content: url(images/backgrounds/location.svg) ' - Alt text is not supported'; |
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
/** | |
* CSS Dark Mode | |
* | |
* Declare color-scheme: light dark in the :root. | |
* Then use the light-dark() function to set both colors. | |
**/ | |
:root { | |
color-scheme: light dark; | |
--bg-color: light-dark(white, black); |
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 | |
/** | |
* Function to update all Gravity Forms 'State' dropdown field (based on field id #6), from full state name values to abbreviated state values if logged into the site. | |
* Use once, then remove the code. | |
*/ | |
function lstreng_update_all_gravity_forms() { | |
// only load for admin panel | |
if ( is_admin() ) { | |
// load all forms | |
$forms = GFAPI::get_forms(); |
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 | |
function lstreng_author_any_post_types $query ) { | |
// apply changes only for author archive page | |
if ( ! is_author() || ! $query->is_main_query() ) | |
return; | |
$query->set('post_type', 'any'); | |
} | |
add_action( 'pre_get_posts', 'lstreng_author_any_post_types' ); |
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: Deactivate Plugins Locally | |
Description: Deactivate specific plugins on your local environment if defined in a wp-config-local.php file. | |
Version: 1.0 | |
*/ | |
require_once(ABSPATH . 'wp-admin/includes/plugin.php'); | |
if ( defined( 'LOCAL_DISABLED_PLUGINS' ) ) { // If defined in wp-config-local.php | |
$plugins_to_disable = unserialize( LOCAL_DISABLED_PLUGINS ); |
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 | |
// Example: Query to show pages that have a meta_value that contains a string (not exact) | |
// https://rudrastyh.com/wordpress/meta_query.html | |
$args = array( | |
'post_type' => 'page', | |
'meta_query' => array( | |
array( | |
'value' => '[contact-form-7 id="13127" title="Alliance', | |
'compare' => 'LIKE' | |
) |
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
# Retrieve images from Production if not found locally | |
RewriteCond %{REQUEST_URI} ^/path/to/files/[^\/]*/?.*$ | |
RewriteCond %{HTTP_HOST} !^www\.your-domain\.com$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f [NC] | |
RewriteRule ^(.*)$ https://www.your-domain.com/$1 [QSA,L] |
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
// Form alter for the User Registration form | |
function MODULE_user_form_user_register_form_alter(&$form) { | |
if (isset($form['field_address'])) { | |
$form['field_address']['widget'][0]['address']['#after_build'][] = 'wrf_user_address_after_build'; | |
} | |
} | |
// Custom function for #after_build | |
function MODULE_user_address_after_build($element, FormStateInterface $form_state) { | |
// Move the country field to the 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
/** | |
* Woocommerce Sorting Dropdown | |
* @param $orderby | |
* @return mixed | |
* | |
* Remove items from sorting dropdown | |
*/ | |
function ls_woocommerce_catalog_orderby( $orderby ) { | |
// We still need to add the functionality that actually does the sorting | |
$orderby['oldest_to_recent'] = __( 'Sort by date: oldest to newest', 'woocommerce' ); |
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
/** | |
* Woocommerce Sorting Dropdown | |
* @param $catalog_orderby | |
* @return mixed | |
* | |
* Changing "Default Sorting" to "Recommended sorting" on shop and product settings pages | |
*/ | |
function ls_update_sorting_name( $catalog_orderby ) { | |
$catalog_orderby = str_replace("Default sorting", "Recommended sorting", $catalog_orderby); | |
return $catalog_orderby; |
NewerOlder