This topic has 10 replies, 3 voices, and was last updated 9 years by Radu.

  • Author
  • #84131
     sashaD
    Participant

    Hello,

    I created custom post type (agent listing) in my child theme, and am building single-agent.php template, I would like to put an image carousel to display images which are added to agent as custom fields. before going and downloading some other jquery script, i realise Kleo already has something which fulfills the carousel function.

    Could you please give advice on how best integrate a carousel of images into a custom single template. at least which plugin kleo uses and where can i find documentation. all i need is a point in the right direction on how best integrate images carousel into my custom single template.

    This theme is amazing, and i don’t want to overload it with unnecessary extra scripts or plugins. Thank you in advance,

    #84411
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! 🙂

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #85127
     sashaD
    Participant

    Hi, thanks, look forward to reply.

    #85460
     sashaD
    Participant

    Hello? it’s been a weak since i asked a question, and no one has replied.

    #85613
     Radu
    Moderator

    Hi,

    This is the shortcode for kleo images carouse

    COPY CODE
    
    [vc_images_carousel images="7880,7882,7030" img_size="400x200" autoplay="yes" min_items="3" max_items="10"]
    

    7880,7882 and 7030 represents attachment id, insert this code and replace these ID’s with your desired images.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #85647
     sashaD
    Participant

    Hi Radu,

    Thank you for reply, but your answer is for putting an individual carousel per post by hand with fixed images.

    as I mentioned, I need to integrate a carousel into a template, i.e. into a single-custompost.php template, so that my custom single posts in child theme have a carousel of images associated with the relevant post.

    e.g. it’s a listings website, and each custom post is a listing, and each listing has a carousel of images associated with that post.

    Look forward to hearing from you,
    best regards
    Sasha

    #85734
     Radu
    Moderator

    Hi sashaD,

    Please add this snippet to your kleo-child/style.css

    COPY CODE
    
    
    function GetCurrentAttachmentIDs() {
    
        $GetAttchmentIDS = implode(',', array_keys(get_attached_media( 'image', get_the_ID() )));
        return do_shortcode('[vc_images_carousel images="'.$GetAttchmentIDS.'" img_size="400x200" autoplay="yes" min_items="3" max_items="10"]');
    }
    
    add_shortcode('attachmentID','GetCurrentAttachmentIDs');
    

    Then when you add a post add this [attachmentID] shortcode to content to run the carousel with the associated images to that post.

    If you want to carousel to be generated automatically for each CPT posts add in your created template :

    COPY CODE
    
    <?php echo do_shortcode( '[attachmentID]' ); ?>
    

    Best Regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #85763
     sashaD
    Participant

    @Radu

    Dear Radu,
    THANK YOU VERY MUCH! i can not show gratitude enough, as i was stuck with this thing for ages, trying to work it out myself not realizing i could ask you guys.

    Just a quick follow up question, how could i edit it, so that the carousel only shows when there are actual images associated with the post- so when there is no images, the carousel doesnt pop up (right now even posts without images have a carousel with blank boxes)?

    all the best
    Sasha

    #85778
     Radu
    Moderator

    Hi again,

    You’re welcome @sashaD

    Please update the code from functions.php with this

    COPY CODE
    
    function GetCurrentAttachmentIDs() {
    
        if( $GetAttchmentIDS = implode(',', array_keys(get_attached_media( 'image', get_the_ID() ))) ) {
    
        return do_shortcode('[vc_images_carousel images="'.$GetAttchmentIDS.'" img_size="400x200" autoplay="yes" min_items="3" max_items="10"]');
    
        }
    }
    
    add_shortcode('attachmentID','GetCurrentAttachmentIDs');
    

    The carousel will be rendered only if the post will have attachments associated.

    Best regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #85788
     sashaD
    Participant

    Once again BIG THANK YOU @Radu

    all working great,
    MAY U HAVE A GREAT WONDERFUL DAY!!!

    #85950
     Radu
    Moderator

    You’re welcome,

    Also don’t forget to rate our theme on Themeforest and give it 5 stars 🙂

    http://themeforest.net/downloads/

    Best regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?