• Hello,

    I’m working with a wordpress child-theme and tried to insert the html-code of an advanced gallery (type carousel) in a custom template. I have to do it this way instead of create the kadence gallery directly in wordpress-editor, because all values like featured image, caption and custom-links are generated automatically with php and variables.

    To load the kadence scripts and styles to the header, I’ve put this code in my functions.php:

    
    function my_custom_js() {
    
       echo "<script type='text/javascript' src='https://mydomain.com/wp-content/plugins/kadence-blocks/dist/vendor/slick.min.js?ver=1.9.3' id='kadence-slick-js'></script>
    	   <script type='text/javascript' src='https://mydomain.come/wp-content/plugins/kadence-blocks/dist/kt-slick-init.js?ver=1.9.3' id='kadence-blocks-slick-init-js'></script>
    <link rel='stylesheet' id='kadence-blocks-gallery-css'  href='https://mydomain.com/wp-content/plugins/kadence-blocks/dist/blocks/gallery.style.build.css?ver=1.9.3' type='text/css' media='all' />
    <link rel='stylesheet' id='kadence-blocks-pro-slick-css'  href='https://mydomain.com/wp-content/plugins/kadence-blocks/dist/vendor/kt-blocks-slick.css?ver=1.9.3' type='text/css' media='all' />";
    }
    // Add hook for admin <head></head>
    add_action( 'admin_head', 'my_custom_js' );
    // Add hook for front-end <head></head>
    add_action( 'wp_footer', 'my_custom_js' ); 

    To get the original html-code, I made a gallery with the wordpress-editor and switched it to “edit as html-code”. Then I copied the code and pasted it into my template.

    The result looks good on a desktop screen, and even if I resize the window to smartphone view, it seems, that the carousel is displayed correctly.

    But when I load the page on my mobile, the images aren’t displayed in a row and have different dimensions, and the previous/next-buttons are missing!

    The kadence-scripts and -css-styles are loaded correctly in the header of the page. So why is there a difference between creating a carousel-gallery in the wordpress-editor or with html-code in a template? Is there anything I’ve forgotten?

    Thank you very much in advance for your help!
    Andreas

    • This topic was modified 3 years, 12 months ago by Andreas 2013.
    • This topic was modified 3 years, 12 months ago by Andreas 2013.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Andreas 2013

    (@andreas-2013)

    Hello again,
    it seems, that the problem was some wrong code in my custom template (or style.css). After modifiying a few other parts of these files, the gallery is working suddenly without problems ??

    hannah

    (@hannahritner)

    Hi @andreas-2013,
    Glad things are working! Let us know if there’s anything else we can help you with.

    Best,
    Hannah

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Advanced gallery isn’t displayed correctly when inserted as html code’ is closed to new replies.