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
| 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 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
| // Here, we are getting all values so we're using a 'do not match' scenario | |
| { | |
| "meta_key": "field_slug", | |
| "meta_value": 100, | |
| "meta_type": "NUMERIC", | |
| "meta_compare": "NOT LIKE", | |
| "orderby": "meta_value", | |
| "order": "DESC" | |
| } |
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
| // In this example we are getting a checkbox and dropdown field (noted below) and then calculating the sum. Then, we update a custom field with the total. | |
| add_action( 'save_post', 'custom_field_calc', 20, 2 ); | |
| function custom_field_calc( $id, $post ) { | |
| // bail out if this is an autosave | |
| if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { | |
| return; | |
| } | |
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
| // Here we are targeting a Hubspot form, grabbing the GCLID (from a Google ad click) and popping it into the hidden Hubspot field value that has the ID of GCLID. | |
| jQuery(".hs-form").submit(function() { | |
| ga(function() { | |
| if (jQuery('#gclid').length) { | |
| jQuery("#gclid").val(ga.getAll()[0].get('_gclid')); | |
| } | |
| }); | |
| }); |
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
| // Get the Group | |
| $thegroup = get_field('group_name'); | |
| // Get the Sub Field | |
| echo $thegroup['sub_field_name']; |
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
| 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 |
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
| /* 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 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
| 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 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
| //// 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 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
| 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]; | |
| } |
NewerOlder