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 the post type and slug to the <body> class, e.g., "page-about". | |
*/ | |
add_filter( 'body_class', function( $classes ) { | |
global $post; | |
if ( isset( $post ) ) { | |
$classes[]= "{$post->post_type}-{$post->post_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 | |
/** | |
* Reduce the font sizes in the WordPress tag cloud | |
*/ | |
add_filter( 'widget_tag_cloud_args', function( $args ) { | |
$args['smallest'] = 11; | |
$args['largest'] = 24; | |
$args['unit'] = 'px'; | |
return $args; | |
}); |
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 | |
/** | |
* This code went into the file in piklist/parts/metaboxes | |
*/ | |
/* | |
Title: Section Name | |
Post Type: page | |
Top pages only: true | |
*/ |
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 | |
/** | |
* Custom Image Sizes | |
* - adds all custom image sizes to the list of choices in Insert Media | |
*/ | |
add_filter( 'image_size_names_choose', function ( $sizes ) { | |
global $_wp_additional_image_sizes; | |
if ( !empty( $_wp_additional_image_sizes ) ) { | |
foreach ( $_wp_additional_image_sizes as $id => $data ) { | |
if ( !isset( $sizes[$id] ) ) |
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 | |
/** | |
* Widget Shortcode | |
* - allows you to insert a widget into any content area using a shortcode | |
* - credit: http://wp.smashingmagazine.com/2012/12/11/inserting-widgets-with-shortcodes/ | |
* - read the comments on the Smashing Magazine article for pros and cons of this function | |
*/ | |
add_shortcode( 'mcw_widget', function ( $atts ) { | |
// configure defaults and extract the attributes into variables | |
extract( shortcode_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
<?php | |
/** | |
* Add Title Field | |
* - adds image caption to image tags; will show up as gallery captions | |
* - this example uses image caption if defined, with fallback to post title | |
* - edit as desired to choose post title, description, or caption (excerpt) | |
*/ | |
add_filter( 'wp_get_attachment_link', function( $anchor, $id ) { | |
$_post = get_post( $id ); | |
if ( !$_post ) { |
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
if ( is_admin() ) { | |
// soften post lock to post warning | |
add_filter( 'show_post_locked_dialog', '__return_false' ); | |
add_filter( 'wp_check_post_lock_window', '__return_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
/* ========================================================================== | |
SVG to CSS Example: Breadcrumbs "Home Icon" | |
- an example of using the Open Iconic SVG code to create a "home" icon | |
- this is the same method as used in the Bootstrap 4 _variables.sccs file | |
- started by downloading the distro from https://useiconic.com/open | |
- found the 'home' icon SVG and copied its path code | |
- then pasted the path code into one of the Bootstrap icon definitions & | |
changed the fill color | |
========================================================================== */ | |
$link-color: blue; |
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
$css_timestamp = filemtime( get_stylesheet_directory() . '/assets/css/app.css' ); | |
wp_enqueue_style( 'child_app', get_stylesheet_directory_uri() . '/assets/css/app.css', null, $css_timestamp ); |
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
<!-- Get and display the My Account page url --> | |
<?php echo get_permalink( wc_get_page_id( 'checkout' ) ); ?> | |
<!-- Get and display the Cart page url --> | |
<?php echo get_permalink( wc_get_page_id( 'cart' ) ); ?> | |
<!-- Get and display the Shop page url --> | |
<?php echo get_permalink( wc_get_page_id( 'shop' ) ); ?> | |
<!-- Get and display the Checkout page url --> |
OlderNewer