Forums

content slider link to next post (1 post)

  1. RavHamster
    Member
    Posted 5 months ago #

    Im a noob at all the php and wordpress stuff, but im trying to learn, so bear with me :)

    I have a content slider on my website. It can load a fixed number of posts into the slider from a category, or all the posts in a category.(0 for unlimited, 0< for fixed number).

    Problem is that i will have quite allot of posts it will have to load. If i set it to 0 and let it load all, the loadtimes wouldnt be very good.

    Instead i tought it might be possible to only let it load one(the newest) from a category, and then let the links get the next one(second newest). The code the slider uses looks like this:

    <?php if (have_posts()) : while (have_posts()) : the_post();
    		global $post; ?>
    
    			<?php if ( $et_slider_type == 'cycle' ) { ?>
    				<div class="slide">
    		<a id="left-arrow" href="#"><?php esc_html_e('Previous','Chameleon'); ?></a>
    		<a id="right-arrow" href="#"><?php esc_html_e('Next','Chameleon'); ?></a>
    					<?php
    					$width = 960;
    					$height = 332;
    					$titletext = get_the_title();
    
    					$thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,false,'Featured');
    					$thumb = $thumbnail["thumb"];
    					print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>
    					<div class="featured-top-shadow"></div>
    					<div class="featured-bottom-shadow"></div>	
    
    					<div class="featured-description">
    						<h2 class="featured-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    						<p><?php //truncate_post(1); ?></p>
    						<a href="<?php the_permalink(); ?>" class="readmore"><?php esc_html_e('Read More', 'Chameleon'); ?></a>
    					</div> <!-- end .featured-description -->
    				</div> <!-- end .slide -->
    			<?php } ?>

    Ive toyed around with this a bit, and was able to get the url to the next posts, but then it just links directly to the next post, not put information inside the slider.

    Using the links "next" "and previous" how can i make it load newer and older posts?

    Hope someone can help

Reply

You must log in to post.

About this Topic