• hey guys. Im new to the wordpress so sorry if something will sound silly to you. Im haveing trouble with my custom theme. Everytime i try to navigate to 2nd (or third or whatever) page, it is still the same first page. However this is happening only on my home page (which is a static page). I have tried many forums but nothing seems to work for me. Here is a query from my index.php (Im not even sure if it is the right part of code).

    $args = array(
    			'paged' => $paged,
    			'tax_query' => array(
    				array(
    				'taxonomy' => 'post_format',
    				'field' => 'slug',
    				'terms' => $filterformats,
    				'operator' => 'NOT IN'
    				)
    			)
    		);
    
                       query_posts( $args );
    		*/
    
    		if (have_posts()) : while (have_posts()) : the_post();

    Hope you can help me
    Greedings from Slovakia
    (also sorry for bad english 😉 )

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try setting ‘paged’ this way:

    if ( get_query_var( 'paged' ) ) :
    	$paged = get_query_var( 'paged' );
    elseif ( get_query_var( 'page' ) ) :
    	$paged = get_query_var( 'page' );
    else :
    	$paged = 1;
    endif;

    Also, as noted in the documentation, query_posts is not meant to be used like this. https://codex.wordpress.org/Function_Reference/query_posts

    See WP_Query instead. https://codex.wordpress.org/Class_Reference/WP_Query

    Thread Starter sisinqo

    (@sisinqo)

    thank you very much for your reply. However, still the same result 🙁

    Just to be sure i understand what you mean by “setting paged this way” i have deleted the last line of code

    if (have_posts()) : while (have_posts()) : the_post();

    with the code you gave me. Do you have any more suggestion? THX angain

    what you mean by “setting paged this way”

    the suggested code should be added before the section posted by you.

    only on my home page (which is a static page).

    does your theme have a page.php? or is that static page using a page template? or are you using any other method to show posts on that static page?

    Thread Starter sisinqo

    (@sisinqo)

    thx for reply. i ve tried to add mindctrl ´s code before that section, still same result.

    my theme does have page.php and i have also find the same code (the code from my second post) there, tried to add it also there, still same result 🙁

    Do you have any more suggestion?
    again guys, thank you really much for your afford.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Page/2/ not working on static page’ is closed to new replies.