• Hi there,

    i’ve got an issue with my mobile theme.
    The pagination does not work probperly – when clicking on “older entries” i always get the same results…

    Why doesn’t it work?

    <?php get_header();
    	$options = wps_panel_get_options(); 
    
    	// Query page home  $the_query = new WP_Query('pagename=home');
    	// $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	// $the_query = new  WP_Query('pagename=home' . 'paged=' . $paged);
    	//$the_query = new WP_Query();
    
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$the_query = new  WP_Query('pagename=home' . 'paged=' . $paged);
    
    	while ( $the_query->have_posts() ) : $the_query->the_post();
    ?>
    
        <?php
            if (has_post_thumbnail( $post->ID ) ): ?>
            <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
    
            <div id="featured-image">
                    <?php
                    if ( get_post_meta($post->ID, 'extralink', true) ) { ?>
                <a>ID, 'extralink', true) ?>">
                    <img src="<?php echo $image[0]; ?>">
                </a>
            <?php }else {?>
                        <img src="<?php echo $image[0]; ?>">
                    <?php } ?>
            </div>
        <?php endif; ?>
    
        <?php
            $content = get_the_content();
            $content = preg_replace('/<a href="(.*?)">(.*?)<\/a>/', "\\2", $content);
             if($content) : ?>
                 <div class="cf content">
                    <?php the_content(); ?>
                 </div><!-- /.content -->
        <?php endif; endwhile;  ?>
    
        <div class="cf content no-padding">
        <?php
            if($options['wps_latest_news'] == 'true') :
         ?>
        <?php
            $page_id = 2;
            $page_data = get_page( $page_id );
        ?>
    
        <div class="strip latest shadow pl-15">
        Neueste Beitr?ge
        </a><a>" class="btn-more">Mehr</a>
        <?php next_posts_link('? Older Entries') ?>
        </div> 
    
        <?php
            $post_num = -1;
            if(isset($options['wps_latest_news_posts_num'])) :
                $post_num = $options['wps_latest_news_posts_num'];
                endif;
            ?>
    
        <?php 
    
            $query_posts = null;
            $query_posts = new WP_Query('posts_per_page='.$post_num.''); 
    
            while($query_posts->have_posts()) : $query_posts->the_post();
            $image2 = null; // reset
            // Get thumb of news posts
            if (has_post_thumbnail( $post->ID ) ):
            $image2 = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'item-thumbnail' );
    
            endif;
         ?>
    
        <div class="post">
    
        <a href="<?php
        the_permalink(); ?>" class="cf">
    
        <?php 
    
        if($image2[0] !== null) : ?>
        <img src="<?php echo $image2[0]; ?>" class="post-thumb" >
        <?php endif; ?>
    
        <div class="post-container">
    
        <h3><?php
        echo get_the_title(); ?></h3>
    
        <?php
        if($options['wps_post_dates'] == 'true') : ?>
        <p class="date"><i><?php echo get_the_date(); ?></i></p><!-- /.date-->
        <?php endif; ?>
    
        <p>
        <?php
        $content = get_the_content();
    
        $getlength = strlen($content);
                            $thelength = 65;
                            echo substr($content, 0, $thelength);
                            if ($getlength > $thelength) echo " [...]"; ?>
        </p>
        </div><!-- /.post-container-->
    
        </div><!-- /.post-->
    
    <?php endwhile; ?>
    
    <?php
    endif; ?>
    
    </div>
    
    <?php
    if($options['wps_fom_homepage_display'] == 'true')
    {
    	include('calltoaction.php');
    }
    ?>
    
    <?php get_footer(); ?>
  • The topic ‘Browsing pages brings same results?’ is closed to new replies.