• tarundeology

    (@tarundeology)


    Hello,

    I like your plugin, but I’m having problem with post’s image with different sizes/resolution. I prefer the featured image set as background (background-size:cover) of the container (fixed or min-height) so that regardless of what size the featured image is, the carousel will have fixed height, not changes every time the image height changes.

    I tried to modify your code in carousel-generator.class.php, but I’m clueless (I’m still beginner in PHP, still struggling with it’s syntax). Can you help me achieve this?

Viewing 1 replies (of 1 total)
  • Thread Starter tarundeology

    (@tarundeology)

    I found temporary solution, although not update-safe. I edited carousel-generator.class.php. Replace line 368 with:

    $out.= '<div class="wp-posts-carousel-container" style="background: url(' . $image[0] . ') no-repeat center center; background-size: cover;">';

    Then in my css, I set min-height for the container:

    .simple-theme.wp-posts-carousel .wp-posts-carousel-slide, #about .simple-theme.wp-posts-carousel .wp-posts-carousel-container {
        padding: 0;
        min-height: 460px;
    }

    I set the carousel to not display post image. Here’s my shortcode:

    [wp_posts_carousel template="simple.css" post_types="post" all_items="12" show_only="newest" exclude="" posts="" ordering="desc" categories="" relation="and" tags="" show_title="true" show_created_date="true" show_description="false" allow_shortcodes="false" show_category="false" show_tags="false" show_more_button="false" show_featured_image="false" image_source="full" image_height="" image_width="" items_to_show_mobiles="1" items_to_show_tablets="2" items_to_show="4" slide_by="3" margin="10" loop="true" stop_on_hover="true" auto_play="false" auto_play_timeout="4500" auto_play_speed="300" nav="true" nav_speed="400" dots="true" dots_speed="800" lazy_load="true" mouse_drag="true" mouse_wheel="true" touch_drag="true" easing="linear" auto_height="true" custom_breakpoints=":"]

    I don’t like this because it is not upgrade-safe, but it works on my site. Hope it helps anyone who have the same concern as mine. ??

Viewing 1 replies (of 1 total)
  • The topic ‘Post’s featured image as background of container’ is closed to new replies.