New answers tagged archives
At first glance, that should just work, as long as you've flushed your rewrite rules. You can do that by going into the settings and saving permalinks again.
Here's a more readable version of the solution provided by Michael <?php $posts = new WP_Query(array('posts_per_page' => -1)); if ($posts->have_posts()): ?> <ul id="archives"> <?php $prev_month = ''; while ($posts->have_posts()): $posts->the_post(); if (get_the_date('F Y') != $prev_month): $...
Use the Index of the post currently being displayed to trigger when your custom content is rendered. current_post can be found on WP_Query from within the loop. <?php while( $archive_query->have_posts() ) : $archive_query->the_post(); ?> <article <?php post_class(); ?>> The Content </article> <?...
The is_category function checks the queried object. Since this is in pre_get_posts, the query has not happened yet. Check the other parameters to find if the query is going to be for cat 5, not if the results are for cat 5. Try ->get('cat').
http://src.wordpress-develop.dev/category/Markup/ or another link is not a post type archive page, it is a archive page. archive page is not a post type archive page. archive page access link like above, but post type archive page access link like: http://src.wordpress-develop.dev/(post-type) replace the (post-type) with the really post type. There is no ...
There is no archive pages for the build in post types, only for custom post types when has_archive is set. In general, the homepage is accepted to be the archive page for the post type post, but it is not an official archive page in the sense of custom post type archive pages. You can create archive pages for the build in post types, but that will require ...
When 'is_post_type_archive()' return true? is_post_type_archive() returns true for custom post type archives and false for default posts. Use is_archive() to check for default posts.
<?php $QUERY = new Wp_query(array( 'post_type' => 'post_type_here', 'category_name' => 'category_name_here', // you can use cat id ... )); $counter = 0; while( $QUERY->have_posts() ) : $QUERY->the_post(); $views = absint( getPostViews( $post->ID ) ); $counter += $views; endwhile; ...
Top 50 recent answers are included