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 orderby parameter to the url for the sorting | |
function add_orderby() { | |
if ( isset( $_GET['orderby'] ) ) { | |
if ( in_array( $_GET['orderby'],[]) ) { | |
set_query_var( 'orderby', 'meta_value_num' ); | |
set_query_var( 'meta_key', $_GET['orderby'] ); | |
} | |
} |
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 | |
//For use with a single field. | |
$video = get_field('video'); //Embed Code | |
$video_url = get_field('video', FALSE, FALSE); //URL | |
$video_thumb_url = get_video_thumbnail_uri($video_url); //get THumbnail via our functions in functions.php ?> | |
<?php //Lightbox Link via Thumbnail ?> | |
<a href="#lightbox"><img src="<?php echo $video_thumb_url; ?>"/></a> |
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 | |
function get_youtube_video_ID($youtube_video_url) { | |
/** | |
* Pattern matches | |
* http://youtu.be/ID | |
* http://www.youtube.com/embed/ID | |
* http://www.youtube.com/watch?v=ID | |
* http://www.youtube.com/?v=ID | |
* http://www.youtube.com/v/ID | |
* http://www.youtube.com/e/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 | |
$args = array( | |
'post_type' => array('testimonial', 'other_post_type', 'another-post-type'), | |
'posts_per_page' => 1, | |
'tax_query' => array( | |
array ( | |
'taxonomy' => 'testimonial_category', | |
'field' => 'slug', | |
'terms' => 'home' | |
) |
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 | |
$loop = new WP_Query( array( | |
'post_type' => 'the post type', | |
'posts_per_page' => -1 | |
) | |
); | |
?> | |
<?php while ( $loop->have_posts() ) : $loop->the_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
.full-image-div{ | |
width:100%; | |
height:100%; | |
object-fit: cover; | |
overflow: hidden; | |
} |
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 | |
$vf = get_sub_field( 'videolink' ); | |
preg_match('/src="(.+?)"/', $vf, $matches); | |
$vf = end(explode('/', reset(explode('?', $matches[1])))); | |
?> | |
<?php if($vf): ?> | |
<a class="button button__play js-modal-btn" href="#" data-video-id="<?php echo $vf; ?>">Watch</a> | |
<? endif; ?> |
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 get_excerpt($limit, $source = null){ | |
$excerpt = $source == "content" ? get_the_content() : get_the_excerpt(); | |
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt); | |
$excerpt = strip_shortcodes($excerpt); | |
$excerpt = strip_tags($excerpt); | |
$excerpt = substr($excerpt, 0, $limit); | |
$excerpt = substr($excerpt, 0, strripos($excerpt, " ")); | |
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); | |
$excerpt = $excerpt.'... <a href="'.get_permalink($post->ID).'">more</a>'; |
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 hide_editor() { | |
remove_post_type_support('page', 'editor'); | |
} | |
add_action( 'admin_init', 'hide_editor' ); |
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 | |
$recent_posts = wp_get_recent_posts(); | |
?> | |
<?php $current_class = 'odd';?> | |
<?php foreach( $recent_posts as $recent ):?> | |
<?php $current_class = ($current_class == 'odd') ? 'even' : 'odd'; ?> | |
<div class="<?php echo $current_class ?>"> | |
<?php echo $recent["post_title"]?> | |
<a href="<?php echo get_permalink($recent["ID"])?>">READ MORE</a> |