Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditionally enqueue Navis materials #1760

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions image.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@
if ( $attachment->ID == $post->ID )
break;
}

$k++;

// If there is more than 1 attachment in a gallery
if ( count( $attachments ) > 1 ) {
if ( isset( $attachments[ $k ] ) )
largo_gallery_enqueue();
if ( isset( $attachments[ $k ] ) ) {
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
else
} else {
// or get the URL of the first image attachment
$next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
}
} else {
// or, if there's only 1 image, get the URL of the image
$next_attachment_url = wp_get_attachment_url();
Expand Down
5 changes: 2 additions & 3 deletions inc/enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,17 @@ function largo_enqueue_js() {
*/
function largo_gallery_enqueue() {
$slick_css = get_template_directory_uri() . '/lib/navis-slideshows/vendor/slick/slick.css';
wp_enqueue_style( 'navis-slick', $slick_css, array(), '1.0' );
wp_enqueue_style( 'navis-slick', $slick_css, array(), '1.0', true );

$slides_src = get_template_directory_uri() . '/lib/navis-slideshows/vendor/slick/slick.min.js';
wp_enqueue_script( 'jquery-slick', $slides_src, array( 'jquery' ), '3.0', true );

$slides_css = get_template_directory_uri() . '/lib/navis-slideshows/css/slides.css';
wp_enqueue_style( 'navis-slides', $slides_css, array(), '1.0' );
wp_enqueue_style( 'navis-slides', $slides_css, array(), '1.0', true );

$show_src = get_template_directory_uri() . '/lib/navis-slideshows/js/navis-slideshows.js';
wp_enqueue_script( 'navis-slideshows', $show_src, array( 'jquery-slick' ), '0.11', true );
}
add_action( 'wp_enqueue_scripts', 'largo_gallery_enqueue' );
}

if ( ! function_exists( 'largo_enqueue_child_theme_css' ) ) {
Expand Down
1 change: 1 addition & 0 deletions inc/widgets/largo-author-bio.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function widget( $args, $instance ) {
} else {
$bio = '';
}

if ( ! is_author() && empty( $bio ) ) {
unset( $authors[$key] );
} else {
Expand Down
8 changes: 5 additions & 3 deletions lib/navis-slideshows/navis-slideshows.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ function __construct() {
if ( ! is_admin() )
return;

add_action('save_post', array( &$this, 'tag_post_as_slideshow' ), 10, 2);
remove_shortcode('gallery');
add_shortcode('gallery', array(&$this, 'handle_slideshow'), 10, 2);
add_action( 'save_post', array( &$this, 'tag_post_as_slideshow' ), 10, 2);
remove_shortcode( 'gallery' );
add_shortcode( 'gallery', array( &$this, 'handle_slideshow' ), 10, 2);
}

/**
*
* @uses global $post WP Post object
* @uses largo_gallery_enqueue();
*/
function handle_slideshow( $output, $attr ) {
largo_gallery_enqueue();
/**
* Grab attachments
*/
Expand Down