0
votes

Here's what i'm doing. Firstly i have a page named 'home' set as frontpage for desktop version. I'm using http://wordpress.org/extend/plugins/device-theme-switcher/ to override default theme(doesn't have any front-page.php file) on mobile.

For mobile version i've created a child theme and using front-page.php to override the default desktop frontpage.

Here's the mobile version http://themes.jdsans.net/momento/ which uses the below code

<?php
    get_header(); 
?>

        <div id="main_container" class="container">

            <div class="row inner_wrap">

                  <div class="main-content clearfix">         

                    <div class="post-content alignleft">
                        <h4 class="column-title">
                            <span><?php _e('Recent Articles','momento_th'); ?></span>
                        </h4>

                        <ul class="clearfix single_cat_thumb">

                        <?php 
                query_posts("posts_per_page=4&paged=".$paged);
            ?>
                        <?php if (have_posts()) : while (have_posts()) : the_post();  ?>                                                     
                            <li class="clearfix item ">

                           </li>

                           <?php endwhile; ?>                              

                        </ul>                           

                        <?php endif;  wp_reset_query(); ?>                           

                        <div class="clear"></div>                           

                    </div>  <!--post-content-->   

        </div><!-- .main-content -->  

            </div><!-- .row-->               

        </div> <!--#main_container-->          

I've tried almost all the fixes that i've found so far but none of them works. Which includes wordpress pagination fix too. But i'm not getting the pagination work.

I've also read many stack's problems but so far no solution.

Also the get_query_var('paged') doesn't seems to return anything when i try add parameter paged to the query arguments

Thanks in advance for the help

2
Removed the code link. Thanks for the infoJdsans

2 Answers

0
votes

Try this one

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

before

query_posts("posts_per_page=4&paged=".$paged);
0
votes

Alright i solved it myself. If somebody else is looking for the same solution. Then in my code above in the question before the query i added

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

And in the function.php of the child theme i added action hook pre_get_posts and hooked the function like below

function modify_query($query) {
    if($query->is_main_query()) {
        $paged = (get_query_var('page')) ? get_query_var('page') : 1;
        $query->set('paged',$paged);
    }
}