Home>Support>Carousel on Post page*[blog]
  1. 8 years, 10 months ago Krištof Kelecsényi

    huh, that is weird.

    My topic shoudl continue like this. I have the code

        
    <?php
    
              $args = array(
                'post_type'     => 'post',
                'category_name' => 'zvyraznene-featured'
              );
              $the_query = new WP_Query( $args );
    
            ?>
    
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
              <!-- Indicators -->
              <ol class="carousel-indicators">
                <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                
                <li data-target="#carousel-example-generic" data-slide-to="<?php echo $the_query->current_post; ?>" class="<?php if( $the_query->current_post == 0 ):?>active<?php endif; ?>"></li>
                
                <?php endwhile; endif; ?>
              </ol>
    
              <?php rewind_posts(); ?>
    
              <!-- Wrapper for slides -->
              <div class="carousel-inner">
    
                <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
                <div class="item <?php if( $the_query->current_post == 0 ):?>active<?php endif; ?>">
    
                  <?php
                    $thumbnail_id = get_post_thumbnail_id(); 
                    $thumbnail_url = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail-size', true );
                    $thumbnail_meta = get_post_meta( $thumbnail_id, '_wp_attachment_image_alt', true);                
                  ?>
                  <a href="<?php the_permalink(); ?>"><img class="img-responsive center-block" src="<?php echo $thumbnail_url[0]; ?>" alt="<?php echo $thumbnail_meta; ?>"></a>
                  <div class="carousel-caption"><?php the_title(); ?></div>
                </div>
                
                <?php endwhile; endif; ?>
    
              </div>
    
              <!-- Controls -->
              <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                <span class="glyphicon glyphicon-chevron-left"></span>
              </a>
              <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
                <span class="glyphicon glyphicon-chevron-right"></span>
              </a>
            </div>
    
     

    It worked before on different template. But i don know in which file i should insert it in the Vantage theme.

    Please tell me which file is the Post page file. I tried to use the Carousel Widget, i put the widget in the BLOG page, but it does not show up.

    Thank you

  2. 8 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Hi Krištof

    Try this:

    1. Go to Settings > Reading and deselect your posts page. Don’t select any page to show your posts.
    2. Go to Pages > Blog, click the Page Builder tab and insert a Post Loop widget.
    3. Choose between the Carousel, Slider or Grid layout options in the template drop down menu.

    Alternatively, to use your own loop:

    1. Install a child theme:

    https://siteorigin.com/wp-content/uploads/2015/03/vantage-child-starter.zip

    Download the ZIP
    Install from Appearance > Themes > Add New: Upload
    Activating a child theme will cause Customizer and menu location settings to reset. That’s expected.

    2. Using FTP or hosting file manager, create a folder in your child theme called “loops”.

    3. Save your custom loop as a .php file. It must have loop in the name. For example:

    custom-loop.php

    4. Follow my earlier steps, your custom loop should now appear in the drop down menu within the Post Loop widget in Page Builder.

  3. 8 years, 10 months ago Krištof Kelecsényi

    Thank you Andrew,

    I tired the first option and it would suit me, but i would like to have also all the post below the Carousel. Is that possible?

  4. 8 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Sure, on one page you could insert another Post Loop widget below the carousel and use the Blog template in the second Post Loop widget.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More