Paginated Archives or Loop by Month

I think this is not very hard to do. If you have currently have paginated date-based archives you can just disable paging when you are in a month overview: add_action( ‘pre_get_posts’, ‘wpse12983_pre_get_posts’ ); function wpse12983_pre_get_posts( &$wp_query ) { if ( $wp_query->is_month() ) { $wp_query->set( ‘nopaging’, true ); } } You can use get_month_link() to get … Read more

Theme Option not Working Inside a Function

1) Move the function to the functions.php file, that’s where it belongs. Put it at the end before any closing ?>: function my_theme_navigation() { global $shortname; if( get_option( $shortname . ‘_next_prev_or_paginate’ ) == ‘Next’ ) : // the block for next-prev navigation previous_posts_link (‘Newer’); next_posts_link(‘Older’); else : // the block for pagination global $wp_query; $big … Read more

/tag/tag_name/page/2 gives a 404 error

The current page number is set by the main query, not by your embedded sub-query. Also, you really should not create a second query, alter the main query instead with a filter on pre_get_posts. add_filter( ‘pre_get_posts’, ‘add_custom_type_to_tag_archive’ ); function add_custom_type_to_tag_archive( $query ) { if ( ! is_main_query() or ! is_tag() ) return $query; $query->set( ‘post_type’, … Read more

Customise wp_List_pages to output a UL LI

Arguments of wp_link_pages() Maybe this will work for you: $args = array( ‘before’ => ‘<ul><li>’ . __( ‘Pages:’ ), ‘after’ => ‘</li></ul>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘next_or_number’ => ‘number’, ‘separator’ => ‘</li><li>’, ‘nextpagelink’ => __( ‘Next page’ ), ‘previouspagelink’ => __( ‘Previous page’ ), ‘pagelink’ => ‘%’, ‘echo’ => 1 ); wp_link_pages( $args … Read more

How to customize wp_link_pages()?

You can use next_or_number param of wp_link_pages to achieve this. From Codex: next_or_number (string) Indicates whether page numbers should be used. Valid values are: number (Default) next (Valid in WordPress 1.5 or after) Then you can use nextpagelink and previouspagelink params to modify these links texts. So doing it like this should do the job: … Read more

Wp pagination for custom database table

Add this code to your functions.php file: $customPagHTML = “”; $query = “SELECT * FROM custom_table”; $total_query = “SELECT COUNT(1) FROM (${query}) AS combined_table”; $total = $wpdb->get_var( $total_query ); $items_per_page = 4; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; $offset = ( $page * $items_per_page ) – $items_per_page; $result = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)