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
/** | |
* Eg : [gettabs category="hydraulic" type="slug"] | |
* Shortcode for getting a list of tabs from a product category | |
* | |
* Shortcode attributes : | |
* type (optional): type of resultset values returned (slug or id) Default: slug | |
* category (required): slug of product category | |
* | |
* returns comma-separated string of tab slugs or tab ids | |
*/ |
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
// ================================================================================================ | |
// FLIPPING THE GET SHORTCODE TO GET CATS IN A RESTRICTED FASHION ^CW | |
// ================================================================================================ | |
/** | |
* Eg : [getcats type="slug"] | |
* Shortcode for getting a list of categories from a current product category & restricted by product brand | |
* | |
* Shortcode attributes : | |
* type (optional): type of resultset values returned (slug or id) Default: slug |
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
/** | |
* Remove WooCommerce Lightbox | |
*/ | |
add_action( 'init', 'my_remove_lightbox' ); | |
function my_remove_lightbox() { | |
remove_theme_support( 'wc-product-gallery-lightbox' ); | |
} |
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
add_shortcode( 'return_post_id', 'gimme_post_id' ); | |
function gimme_post_id() { | |
return get_the_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
function acf_event_date( $atts ) | |
{ | |
// extract attributes | |
extract( shortcode_atts( array( | |
'field' => '', | |
'post_id' => false, | |
'format_value' => true, | |
'date_format' => '' | |
), $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
function go_convert_youtube_url_to_embed_url($youtube_url) { | |
$matches = array(); | |
preg_match('/((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?/', $youtube_url, $matches); | |
return "https://www.youtube.com/embed/".$matches[5]; | |
} |
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
//// Browser/OS Body Class | |
function mv_browser_body_class($classes) { | |
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; | |
if($is_lynx) $classes[] = 'lynx'; | |
elseif($is_gecko) $classes[] = 'gecko'; | |
elseif($is_opera) $classes[] = 'opera'; | |
elseif($is_NS4) $classes[] = 'ns4'; | |
elseif($is_safari) $classes[] = 'safari'; | |
elseif($is_chrome) $classes[] = 'chrome'; | |
elseif($is_IE) { |
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
function mysite_child_pages() { | |
global $post; | |
if ( is_page() && $post->post_parent ) | |
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' ); | |
else | |
$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=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
/* Base HTML */ | |
html { | |
font-size: 62.5%; | |
} | |
p { | |
font-size: clamp(1.4rem, calc(1.4rem + ((1vw - 0.32rem) * 0.4545)), 1.8rem); | |
} |
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
add_shortcode( "the_shortcode", "the_function" ); | |
function the_function() { | |
ob_start(); | |
// Run the loop - Do we have a Repeater field? | |
if ( have_rows( 'repeater_field_name' ) ) : | |
echo '<div class="myclass">'; // Optional if you want to output before the fields |