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 cart count shortcode [cart_count] | |
// ============================================================================= | |
add_shortcode( 'cart_count', 'mb_cart_count' ); | |
function mb_cart_count() { | |
if ( class_exists( 'WooCommerce' ) && function_exists( 'WC' ) ) { // Check for WooCommerce and WC() function. | |
if ( ! WC()->cart->is_empty() ) { | |
return (string) WC()->cart->get_cart_contents_count(); // Cast to string for consistency. |
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 | |
// The following code goes in your functions.php file of a Child Theme | |
function custom_font_mime_types($mimes = array()) { | |
$mimes['woff'] = 'application/x-font-woff'; | |
$mimes['woff2'] = 'application/x-font-woff2'; | |
// Depending on your server setup, you may need to use these instead: | |
//$mimes['woff'] = 'font/woff'; | |
//$mimes['woff2'] = 'font/woff2'; |
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 | |
/** | |
* The following goes in your child theme's functions.php file | |
*/ | |
/** | |
* Generate custom Open Graph images for your blog posts | |
* | |
* @param string $url URL of OG image in HTML Meta. |
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
/** set up our navbar, and position it fixed so there is no white gap above the CS content **/ | |
.x-navbar { | |
border: none; | |
box-shadow: none; | |
transition: background 0.7s ease-out; | |
background: transparent!important; | |
position: fixed; | |
z-index: 1030; | |
top: 0; |
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 theme colors from Pro and turn them into classes and CSS variables | |
* And now add them to Gutenberg for use in blog posts | |
* | |
* Created Date: Wednesday May 25th 2022 | |
* Author: Michael Bourne | |
* ----- | |
* Last Modified: Wednesday, May 25th 2022, 1:36:28 pm | |
* Modified By: Michael Bourne |
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 a body class via the body_class filter in WP | |
// ============================================================================= | |
add_filter( 'body_class', 'mb_body_class_for_cart_items' ); | |
function mb_body_class_for_cart_items( $classes ) { | |
if( ! WC()->cart->is_empty() ){ | |
$classes[] = 'cart-has-items'; | |
} | |
return $classes; |
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 | |
// functions.php in a child theme | |
/** | |
* Change Enhanced Slack sharing data labels. | |
* | |
* @param array $data The default Slack labels + data. | |
* @param Indexable_Presentation $presentation The indexable presentation object from Yoast. | |
* | |
* @return array $data The new Slack labels + data. |
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
jQuery(document).ready(function($){ | |
// Detect if this is a hero image page by looking for the #heroimage ID | |
if( $('#heroimage').length ){ | |
// get the value of the bottom of the #heroimage element by adding the offset of that element plus its height, set it as a variable | |
var mainbottom = $('#heroimage').offset().top + $('#heroimage').outerHeight(true); | |
$(window).on('scroll',function(){ | |
var stop = Math.round($(window).scrollTop()); | |
// If the use has scrolled past the bottom of the hero image |
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
@media (min-width: 768px){ | |
.timeline { | |
position: relative; | |
z-index: 1; | |
} | |
.timeline::before { | |
content:""; | |
position: absolute; | |
z-index: 1; | |
top: 0; |
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 | |
// functions.php in a child theme | |
/** | |
* Disable Yoast's Enahnced Slack Sharing feature on non-posts | |
*/ | |
function mb_disable_slack_enhancements() { | |
if ( 'post' !== get_post_type() ) { | |
add_filter( 'wpseo_output_enhanced_slack_data', '__return_false' ); | |
} |
NewerOlder