• 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”

Viewing 1 replies (of 1 total)
  • 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

    https://www.ads-software.com/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…

    https://www.ads-software.com/extend/plugins/ez-post-archives/
    another option maybe…?

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Archive Listings’ is closed to new replies.