Tag Info

New answers tagged

0

The add_filter followed by remove_filter approach seems hacky, I prefer using a conditional approach like this: /** * Post type archives by month */ function kevinlearynet_getarchives_events( $sql_where, $r ) { // conditions for when you want to do this // (don't do it all the time) if ( is_post_type_archive( 'event' ) ) { $sql_where ...


0

You can use below steps to display pagination. Step 1:- Include the following snippet in your functions.php file :- function webim_pagination ( $pages = '', $range = 4 ) { $showitems = ($range * 2) + 1; global $paged; if( empty( $paged ) ) $paged = 1; if( $pages == '' ) { global $wp_query; $pages = ...


2

If you look at wp_get_archives() you will notice that the link is generated by get_archives_link(). That function supplies a filter that will allow you to replace the parens. This is fairly crude but does work. function archive_link_wpse_183665($link) { $pat = '|\(([^)])\)</li>|'; // preg_match($pat,$link,$matches); // var_dump($matches); ...


0

you can name the file in this way: taxonomy-{taxonomy}.php as described in this page, there you can create a loop adn WP will only select the elements of the given taxonomy.


2

Before Wordpress 4.1, you can show the date archive page titles with the following code: (Taken and slightly modified from the twentyfourteen theme) if ( is_day() ) { printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() ); } elseif ( is_month() ) { printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', ...


0

So thanks for your help. Now i pay more attention to functions.php so my old code have effectively. /* Change page order */ add_filter( 'pre_get_posts' , 'my_change_order' ); function my_change_order( $query ) { // Check if the query is for an archive if($query->is_archive) // Query was for archive, then set order $query->set( 'order' , ...


1

Is the file named content-expertises.php or category-expertises.php? WP will use the first template file it finds in your theme directory from the following list: category-slug.php category-ID.php category.php archive.php index.php https://codex.wordpress.org/Category_Templates


0

You can use pre_get_posts in your functions file for this with the WP_Query order and orderby parameters. function alter_query( $query ) { if ( $query->is_archive() && $query->is_main_query() && !is_admin()) { $query->set( 'posts_per_page', 100 ); } } add_action( 'pre_get_posts', 'alter_query' );



Top 50 recent answers are included