Change class=”page-numbers” in pagination

The paginate_links() function, located in wp-includes/general-template.php, doesn’t allow for certain parts of the HTML (such as the page-numbers class) to be customized. A simple string replacement will not work due to the way that the classes are generated, as highlighted in this excerpt of code from paginate_links(): $page_links[] = ‘<a class=”prev page-numbers” href=”‘ . esc_url( … Read more

How can I see all of a post’s comments on a single page as a reader, if pagination is enabled?

Just build a link that has some query args: printf( ‘<a href=”http://example.com/all-comments?pid=%s”>All comments</a>’ ,get_the_ID() ); Then add a page with a a permalink of all-comments, so you have something to target. There you attach a template like the following (just a base to work off): <?php /** * Template Name: All Comments */ // Abort … Read more

Pre get posts for single post

First of all, $query object is passed by reference, you don’t need to return $query in pre_get_posts. Second, is_post_type_archive( ‘events’ ) will work just fine, you don’t need to use query->query_vars[]. Corrected code will look like this: function my_pre_get_posts( $query ) { if( ! is_admin() && is_main_query() && is_post_type_archive( ‘events’ ) ) { $query->set(‘orderby’, ‘meta_value_num’); … Read more

Single Page View for Paginated Posts

Yes, it is possible, and I use it on my own site. Here it is in action: my Settings API post is paginated, but can viewed on a single page, using the “Single-Page View” link. First, you need to prepare a custom query variable, e.g. in functions.php, add the following: function cbnet_parameter_queryvars( $qvars ) { … Read more

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