• Resolved Danna_ADN

    (@danna_adn)


    Hello,

    I open a new post to explain my problem: I need to automate the renewal of posts in the slider and not come back every day to do so. You said it would be easy to make the slider from the categories but it complicates the theme too, in my case I need to make the slider from the sticky posts (regardless of category).

    Could you give me a few lines of code to explain how to do this? I’m afraid of damaging your great theme and my knowledge of php is limited.

    Our wordpress blog is 2 years old, we would like to change the design for Christmas, everything is ready there is only this little problem to solve and it will be perfect.

    Thank you again for your help and my apologies for my bad english

    a French girl

Viewing 3 replies - 1 through 3 (of 3 total)
  • Well its not that easy, requires some additional coding, I wrote the code for you however i didn’t test that , but I think it should work. If you have a child theme, replace the whole content of includes/index-slider.php with the code below

    <?php
    /**
     * Template for displaying slider on home page
     *
     * @package Supernova
     * @since Supenova 1.0.4
     * @license GPL 2.0
     */
    
    global $supernova_options, $paged;
    
    $post_ids = get_option('sticky_posts');
    
    if($paged==0 && !supernova_options('disable-slider')): ?>
    <div id="supernova_slider_wrapper" class="<?php echo $supernova_options['fade-slider']; ?>">
        <div class="flexslider">
              <ul class="slides">
                <?php
                $post_ids = get_option('sticky_posts');
                if($post_ids){
                foreach($post_ids as $post_id){
                            $slider_image = esc_url(trim($supernova_options['slider'.$i]));
                            $option = $supernova_options['slider-post-excerpt'];
                            $length = $supernova_options['slider-excerpt-length'];
                            $heading_length = $supernova_options['slider-heading-length'];
    
                        if(!$post_id){ break; } ?>
                    <li>
                        <?php if($post_id){ ?>
                            <div class="featured_content">
                                   <?php
                                   echo     '<a href="'.get_permalink($post_id).'">';
                                   echo      "<h3>".supernova_chopper(get_the_title($post_id), $heading_length)."</h3>";
                                   if($option != '3'){
                                       if($option == '1'){
                                        echo     "<p>" . get_the_time('F jS, Y', $post_id). "</p>";
                                       }elseif($option == '2'){
                                        echo supernova_get_excerpt_by_id($post_id, $length);
                                       }
                                   }
                                   echo     '</a>';
                                    ?>
                           </div><!--featured content -->
                            <?php }
                                    if($slider_image){
                                    echo '<img src="'.$slider_image.'" alt="'.get_the_title($post_id).'" />';
                                    }else{
                                    echo '<img src="'.wp_get_attachment_url(get_post_thumbnail_id($post_id)).'" alt="" />';}
                                    ?>
                    </li>
               <?php } } //for loop ENDS ?>
              </ul>
        </div> <!--flexslider -->
    </div><!--slider_wrapper ENDS -->
    <?php endif;
    Thread Starter Danna_ADN

    (@danna_adn)

    You’re WONDERFUL !! Thank you so much and more again, that’s just perfect !!

    Have a nice day/night !

    Danna

    Thanks for the donation , that’s really nice of you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sticky posts in slider’ is closed to new replies.