Articles of wp get archives

Archive page for custom taxonomy grouped by month

I am working on archive page of custom taxonomy of custom post types. I need to show archives by month of particular taxonomy. For retrieving post in particular taxonomy by month. However, I have used following code. function my_custom_post_archive_where($where,$args){ $post_type = isset($args[‘post_type’]) ? $args[‘post_type’] : ‘post’; $where = “WHERE post_type = ‘$post_type’ AND post_status = […]

Make post title active

Hi I have a simple website that displays every post title in a list, I’m trying to change the active post title to be different when its being viewed. I have tried this but it’s not working. <ul class=”students”> <?php $IDOutsideLoop = $post->ID; global $post; $myposts = wp_get_archives(‘type=alpha’); foreach($myposts as $post) : ?> <li <?php […]

get the custom post type title/name

I’m using a custom post type and use this plugin to display my custom post type’s archives, does anyone knows how to display my custom post type’s name/title to the archive.php? Below is the archive.php <?php /** * The template for displaying all single posts and attachments * * @package WordPress * @subpackage Twenty_Fifteen * […]

remove 2014 from wp_get_archives

we have wp_get_archives(‘type=monthly’); function that have a output like this: Archives by Month: January 2014 December 2013 November 2013 but I want style like a table that sorted by years: 2014 January ————- 2013 December November

Get archives as array

I’m looking for a way to get the values returned from wp_get_archives as an array, similar to get_categories. I need to do this to modify the post counters to use – [#] instead of (#). See my current code below: My code for categories, which displays as desired: $cats = get_categories(); if ($cats) { echo […]

Wrap the “show_post_count” between div

How can I wrap the “show_post_count” between a div? (from the wp_get_archives()) Do I need to edit the function for that? Or could I do something like this with pseudo css? <div class=”post_count”> <a href=”″ title=”March 2012″>March 2012</a>&nbsp;(1) </div> Css: .post_count a:after (all the content in the div and after the .post_count){ float: right; }

Shortcode for output of wp_get_archives displays at top of post

Why does the output of this function // One Recent Post function most_recent_post_shortcode() { return wp_get_archives( ‘type=postbypost&limit=1&format=custom’); } add_shortcode( ‘recent-post’, ‘most_recent_post_shortcode’ ); and shortcode [recent-post] show the output at the top of a post rather than in the body of the post where the shortcode is? Is there a better way to use a shortcode […]

Get current title of archive.php

I want to get current title at file archive.php My code : if ( is_category() ){ echo “CATEGORY”; } else if( is_tag() ){ echo “TAGS”; } else if( is_author() ){ echo “AUTHOR”; } else if( is_tax() ){ echo “TAXONOMY”; } else { echo “ARCHIVE”; } Is there a way to simplify this ? I try […]

wp_get_archives custom function broken since upgrading to WP 3.7.1

I’ve upgraded a site I’m working on to the latest WP, but it appears the function I wrote for splitting wp_get_archives() into years is now broken and I can’t find out why. I’ve turned on debugging, but not getting any errors. Can anyone see what’s wrong please? Class OSUYMArchives { public static function init() { […]

How to filter by date & a specific custom post type post-WP 4.4?

WordPress 4.4 introduced the ability to display date archives by appending /?post_type=custom_post_type to the end of the date url. i.e. localhost/2016/02/?post_type=news. I had assumed I could do: if( is_post_type_archive(‘news) && is_date())… But from what I can discern: is_date() will only detect if the page is displaying a year/month/day archive & is_date() applies to all CPT […]