Skip to content

Instantly share code, notes, and snippets.

@giodc
giodc / jQuery if, else, with media query
Created November 27, 2016 20:20
jQuery if, else, with media query
jQuery(document).ready(function () {
if (document.documentElement.clientWidth < 950) {
// do nothing below 950px
}
else
jQuery('.header-widget').css('marginTop', jQuery('.site-header').outerHeight(true) );
});
@giodc
giodc / Use WP-query in WordPress to retrieve Pods Relationship Custom Post Type Content
Created November 27, 2016 20:16
Use WP-query in WordPress to retrieve Pods Relationship Custom Post Type Content
<?php
//get Pods object for current post
$pod = pods( 'room', get_the_id() );
//get the value for the relationship field
$related = $pod->field( 'hotel' );
//loop through related field, creating links to their own pages
//only if there is anything to loop through
if ( ! empty( $related ) ) {
foreach ( $related as $rel ) { ?>
@giodc
giodc / wordpress-check-if-image-is-gif
Last active June 23, 2022 03:54
Check if WordPress featured image is gif, and output full size image to allow animated gif in Loop
<?php
$url = wp_get_attachment_url( get_post_thumbnail_id() );
$filetype = wp_check_filetype($url);
if ($filetype[ext] == 'gif')
{the_post_thumbnail('full', array('class' => 'img-responsive')); }
else