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 // image gallery content | |
if( has_shortcode( $post->post_content, 'gallery' ) ) { | |
// Grab the first gallery in the post | |
$gallery = get_post_gallery_images( $post->ID ); | |
$image_list = '<div class="owl-carousel">'; | |
// Loop through each image in each gallery | |
foreach( $gallery as $image ) { |
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
// Owl Carousel | |
function run_owl() { | |
// Initialize each carousel independently | |
$( ".owl-carousel" ).each( function() { | |
var $carousel = $( this ); //.owl-carousel | |
var $gallery = $( this ).parent(); //.owl-gallery | |
$carousel.owlCarousel( { | |
items : 1, |
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
// This carousel works like it should, but has a little hiccup on mobile where it doesn't calculate the width properly sometimes. If you rotate your phone to landscape and back to portrait, it kicks the carousel back into place. The fix would be to trigger a refresh after the carousel is initialized, so that it recalculates but I can't get it to take. | |
// Helpful links: | |
// See the bug on mobile here: https://preview.arraythemes.com/camera/2014/01/18/test-gallery/ | |
// Owl events: http://www.owlcarousel.owlgraphic.com/docs/api-events.html#refresh-owl-carousel | |
// On how to initialize: https://github.com/OwlFonk/OwlCarousel2/issues/489 | |
// Owl Carousel | |
function run_owl() { |
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
/** | |
* When nesting selectors (conservatively, mind you), you can add & after a selector to apply it as a parent selector. | |
*/ | |
.widget-title { | |
font-size: 20px; | |
.wf-active & { | |
font-size: 22px; | |
} |
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
.main-navigation .nav-menu > li > a { | |
background-color: rgba(0, 0, 0, .1); | |
transition: background-color 1000ms linear; | |
} |
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 theme_infinite_scroll_setup() { | |
add_theme_support( 'infinite-scroll', array( | |
'container' => 'content', | |
'footer' => 'page', | |
'posts_per_page' => 10, | |
) ); | |
} | |
add_action( 'after_setup_theme', 'theme_infinite_scroll_setup' ); |
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
/* | |
* Change the posts_per_page Infinite Scroll setting from 10 to 20 | |
*/ | |
function theme_infinite_scroll_settings( $args ) { | |
if ( is_array( $args ) ) | |
$args['posts_per_page'] = 20; | |
return $args; | |
} | |
add_filter( 'infinite_scroll_settings', 'theme_infinite_scroll_settings' ); |
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 theme_infinite_scroll_setup() { | |
add_theme_support( 'infinite-scroll', array( | |
'container' => 'post-wrapper', | |
'render' => 'theme_render_infinite_posts', | |
'type' => 'scroll' | |
) ); | |
} | |
add_action( 'after_setup_theme', 'theme_infinite_scroll_setup' ); |
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
/* | |
* Change the type Infinite Scroll setting from scroll to click | |
*/ | |
function theme_infinite_scroll_settings( $args ) { | |
if ( is_array( $args ) ) | |
$args['type'] = 'click'; | |
return $args; | |
} | |
add_filter( 'infinite_scroll_settings', 'theme_infinite_scroll_settings' ); |
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 theme support for Infinite Scroll | |
*/ | |
function theme_infinite_scroll_setup() { | |
add_theme_support( 'infinite-scroll', array( | |
'container' => 'post-wrapper', | |
'render' => 'theme_render_infinite_posts', | |
'type' => 'scroll' | |
) ); | |
} |
OlderNewer