Applying Argent’s Carousel to Galleries on Homepage & Pages
-
So while one or two have asked on here about removing Argent’s carousel from pages, and a user provided the code to do that.
I want to apply Argent’s carousel gallery format (slick) to my homepage and other pages. Previously (and showing on my homepage currently), I simply embedded a SmugMug gallery which created a look I enjoy. But with GDPR, switching to GTM for cookie compliance, etc… I’ve ran into issues with that method & blocking the cookies. My solution was to just create a gallery within WP – but on pages & my homepage, it’s the default gallery style.
As noted, I tried to reverse-engineer the advice given in this thread: https://www.ads-software.com/support/topic/first-image-gallery-displayed-as-slider-but-set-as-thumbnail/ (copied below). I already have the child theme set up, and added the fist set of code to the
content-portfolio-single.php
file and swapped the existing<?php the_content(); ?>
for the second bit of code for the carousel – no luck.
(this attempt can be seen here: https://deibertdesigns.com/portfoliogallery/)I tried the same on
page.php
– also no luck, shows the same as above.I feel like I’m either missing something – or perhaps there’s an easier method for adding a gallery to pages & applying Argent’s Slick Carousel? Thanks!
_____________________
Once your child theme is set up, make a copy of the parent theme’scontent-portfolio-single.php
in your child theme folder.We’re going to remove one bit of code, and then replace another one with something different. First, find this block:
<?php if ( get_post_gallery() ) { get_template_part( 'content', 'portfolio-gallery' ); } ?>
and remove it. That’s what produces the slideshow.
Next, look for this block. It’s what removes the original gallery from the post:
<?php $content = get_the_content(); /** * Get the gallery data from the post. */ $gallery_shortcode = argent_get_gallery(); /** * Grab the first shortcode in post content, strip it out, and * display the post content without the first gallery. */ if( $gallery_shortcode && is_array( $gallery_shortcode ) ) { $content = str_replace( $gallery_shortcode[0][0], '', $content ); } echo apply_filters( 'the_content', $content ); ?>
Replace it with this:
<?php the_content(); ?>
The page I need help with: [log in to see the link]
- The topic ‘Applying Argent’s Carousel to Galleries on Homepage & Pages’ is closed to new replies.