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 | |
| $current = $wp_query->get_queried_object(); | |
| // return the ID of the current term | |
| // i.e. ID of term "Photoshop" is "26", so we get "26" if we are viewing "Photoshop" | |
| $current_term_id = $current->term_id; | |
| // return the nicename of the current term | |
| // i.e. returns "Photoshop" |
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 | |
| $taxonomyName = "types"; | |
| //This gets top layer terms only. This is done by setting parent to 0. | |
| $parent_terms = get_terms( $taxonomyName, array( 'parent' => 0, 'orderby' => 'slug', 'hide_empty' => false ) ); | |
| echo '<ul>'; | |
| foreach ( $parent_terms as $pterm ) { | |
| //Get the Child terms | |
| $terms = get_terms( $taxonomyName, array( 'parent' => $pterm->term_id, 'orderby' => 'slug', 'hide_empty' => false ) ); | |
| foreach ( $terms as $term ) { |
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 // Get the taxonomy's terms | |
| $terms = get_terms( | |
| array( | |
| 'taxonomy' => 'types', | |
| 'hide_empty' => false, | |
| 'parent' => 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
| <?php | |
| $taxonomies = get_terms( array( | |
| 'taxonomy' => 'types', | |
| 'hide_empty' => false | |
| ) ); | |
| if ( !empty($taxonomies) ) : | |
| $output = '<select>'; | |
| foreach( $taxonomies as $category ) { |
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 wpd_subcategory_template( $template ) { | |
| $cat = get_queried_object(); | |
| if( 0 < $cat->category_parent ) | |
| $template = locate_template( 'category-child.php' ); | |
| return $template; | |
| } | |
| add_filter( 'category_template', 'wpd_subcategory_template' ); |
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
| // Slide toggle | |
| var linkToggle = document.querySelectorAll(".js-toggle"); | |
| for (i = 0; i < linkToggle.length; i++) { | |
| linkToggle[i].addEventListener("click", function (event) { | |
| event.preventDefault(); | |
| var container = document.getElementById(this.dataset.container); |
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 | |
| $img_id = get_post_thumbnail_id(); | |
| $size = 'large'; | |
| $img_src = wp_get_attachment_image_url( $img_id, $size ); | |
| $img_srcset = wp_get_attachment_image_srcset( $img_id, $size ); | |
| $title = get_post($id)->post_title; | |
| $alt = isset(get_post_meta($id, '_wp_attachment_image_alt')[0]) ? get_post_meta($id, '_wp_attachment_image_alt')[0] : $title; | |
| $caption = wp_get_attachment_caption($img_id); | |
| ?> | |
| <img src="<?php echo esc_url( $img_src ); ?>" |
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 | |
| $hero = get_field('testy', 'option'); | |
| if( $hero ): ?> | |
| <?php echo $hero['inner']; ?> | |
| <?php endif; ?> |
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 | |
| $cta = get_field('testy', 'option'); | |
| if( !empty( $cta ) ): ?> | |
| <?php the_field('testy', 'option'); ?> | |
| <?php endif; ?> |
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 | |
| // check if the repeater field has rows of data | |
| if( have_rows('gallery') ): | |
| // loop through the rows of data | |
| while ( have_rows('gallery') ) : the_row(); | |
| // display a sub field value | |
| ?> | |
| <section class="relative home-hero"> | |
| <div class="glide__track" data-glide-el="track"> | |
| <ul class="glide__slides"> |
NewerOlder