WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Archive Listings (2 posts)

  1. ddeuster
    Member
    Posted 1 year ago #

    Currently I'm using a couple of pages with custom posts that I would like to be able to filter by date. Below is the code I have right now.

    <div class="dd-wrap">
            <select class="styled" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
                <option value=""><?php echo esc_attr( __( 'Date Range' ) ); ?></option>
                    <?php wp_get_archives( 'type=monthly&format=option&show_post_count=1' ); ?>
            </select>
        </div>

    I'd like to limit this to just show the posts that appear in the particular CPT "hwy65_sermons"

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    I'm actually not seeing a way to 'just' get that CPT with wp_get_archives

    I've come across ways to filter the function, we can brute force add in the CPT to the function, which adds it in along with normal posts

    By that same route, we could affect the function to just dispaly the CPT I would think... but that would affect all iterances of wp_get_archives

    http://wordpress.org/extend/plugins/custom-post-type-archives/
    Way down in the descruiption, this plugin claims to offer what you are after, but the plugin doesn't seem maintained anymore, as the main reason that plugin was made is now part of core

    You could just run a query with CPT and date parameters I would think, instead...

    http://wordpress.org/extend/plugins/ez-post-archives/
    another option maybe...?

Topic Closed

This topic has been closed to new replies.

About this Topic