wp_link_page – wrap current page element

I’m trying to make something more meaningful out of the wp_link_pages() result: $paged_page_nav = wp_link_pages( array( ‘echo’ => false ) ); // Now let’s wrap the nav inside <li>-elements $paged_page_nav = str_replace( ‘<a’, ‘<li class=”‘.$classes.'”><a’, $paged_page_nav ); $paged_page_nav = str_replace( ‘/a>’, ‘/a></li>’, $paged_page_nav ); // here I’d need to wrap the currently displayed page element … Read more

Paginate tags page

If I click a random tag I want the tag page to list only 20 posts that is related to that tag and paginate it. <?php /** * The template for displaying Tag Archive pages. */ get_header(); ?> <div id=”container”> <div id=”content” role=”main”> <h1 class=”page-title”><?php printf( __( ‘Tag Archives: %s’, ‘twentyten’ ), ‘<span>’ . single_tag_title( … Read more

Custom post type archive not regarding ‘posts_per_page’ => -1

I have a custom post type archive where WP_Query is used to retrieve the posts. I want to disable pagination and show all posts on this archive, but the following query is not working: $args = array( ‘post_type’ => array( ‘cpt_sports’, ), ‘posts_per_page’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘desc’, ‘max_num_pages’ => 1 ); … Read more

WordPress get pagination on wpdb get_results

How do I gee the numbered pagination of custom wpdb result? below code will show one latest post from each authors in the site. I want to show 20 posts per page with a numbered pagination. $postids = $wpdb->get_results( ” SELECT a.ID, a.post_title, a.post_author, a.post_date FROM $wpdb->posts a JOIN ( SELECT max(post_date) post_date, post_author FROM … Read more

Pagination shows same contents all pages

Here is my loop $my_query = new WP_Query(array( ‘cat’ => -399, ‘posts_per_page’ => 6, ‘offset’ => 5, ‘paged’ => (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1 )); if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); $imgurl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); $finalurl = get_stylesheet_directory_uri(). “/functions/thumb.php?w=180&h=180&a=t&src=”https://wordpress.stackexchange.com/questions/133754/.$imgurl; $date = get_the_date(); $id = $post->ID; ?> …. loop contents … Read more