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 `array`, `arrayupper`, and `arraylower` options to textarea output | |
* | |
* @param $value | |
* @param $post_id | |
* @param $field | |
* @return array|mixed | |
*/ | |
add_filter( 'acf/format_value/type=textarea', function ( $value, $post_id, $field ) { |
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 | |
/** | |
* Preselect the delete old and only missing checkboxes based on the `deleteold` query param | |
**/ | |
add_filter( 'regenerate_thumbnails_options_onlymissingthumbnails', function( $checked ) { | |
return ( empty( $_GET['deleteold'] ) && ( $_GET['deleteold'] !== 'yes' ) ); | |
}); | |
add_filter( 'regenerate_thumbnails_options_deleteoldthumbnails', function( $checked ) { | |
return ( ! empty( $_GET['deleteold'] ) && ( $_GET['deleteold'] === 'yes' ) ); |
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 | |
namespace RMG\PageSpeed; | |
/** | |
* Get the HTML for an image with limited srcset sizes | |
* | |
* @param string|int $image_id | |
* @param string $size The image size name ex. `medium`, `thumb` | |
* @param boolean $icon | |
* @param null|array $attrs | |
* |
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
let copyBtn = document.getElementById( 'copyBtn' ), | |
copyField = document.getElementById( 'fieldID' ); | |
copyBtn.addEventListener( 'click', function( e ) { | |
e.preventDefault(); | |
copyField.focus(); | |
copyField.select(); | |
document.execCommand( 'copy' ); |
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
# list all public taxonomies and the number of entries for each of them | |
wp taxonomy list --fields=name,label,public,count --public=1 | |
# list all public post types and the number of entries for each of them | |
wp post-type list --fields=name,label,public,count --public=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
<?php | |
add_filter( 'woocommerce_breadcrumb_main_term', 'hwid_breadcrumbs_primary_category' ); | |
/** | |
* Override the default term for WooCommerce cookies if Yoast SEO is installed | |
* | |
* @param WP_Term $term | |
* | |
* @return WP_Error|WP_Term|null |
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
.quotation { | |
&:before { | |
content: '\201C'; | |
} | |
&:after { | |
content: '\201D'; | |
} | |
} |
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
if( window.acf ) { | |
window.acf.addAction( 'render_block_preview/type=accordion', function( $elem, blockDetails ) { | |
initializeElement( $elem ); | |
} ); | |
} |
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 | |
namespace RMG\QuoteBuilder; | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
if ( class_exists( 'RMG\QuoteBuilder\Settings_Quotes', false ) ) { | |
return new Settings_Quotes(); |
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 new_category( $categories, $post ) { | |
return array_merge( | |
$categories, | |
array( | |
array( | |
'slug' => 'custom-category', | |
'title' => __( 'Custom Category', 'language' ), | |
), | |
) |
NewerOlder