I'm trying to build a new website, where I'm using the WordPress blog for 'Event Reports' and a custom post type for 'Event Photo Galleries'.
I'm building a custom theme using bootstrap but my php skills are virtually non-existent. Basically, I know which bits of php to paste where, in order to get a basic WordPress theme to work. Beyond this, I have no php skills. I'm using the CPT UI plugin to create the Custom Post Type.
On the blog main page, I display the 12 most recent posts and at the bottom of the page I call a template part with the older/newer links and the following dropdowns:
<form action="<?php bloginfo('url'); ?>/" method="get"><?php $select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6'); $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select; ?></form>
This allow the user to select a blog category (in this case championship names). The user can alternatively choose to filter by Month/Year using this dropdown:
<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Select Month/Year')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?>
</select>
I'd like to replicate these two functions on my Custom Post Type archive pages, allowing the user to see the photo galleries from a particular year or particular championship.
My CPT is called 'gallery' and the taxonomy is 'championship'.
During my lengthy research process, I found these functions listed here: Custom post type yearly/ monthly archive
This seems to format the CPT archive URLS in a logical format. domain.com/gallery/2018/04 will show the April 2018 photo galleries, domain.com/gallery/2018/ will show all of the 2018 galleries. I feel like I'm part way to my goal.
Is there a way to get the Years/Months to appear as a dropdown list as I have for the WordPress blog? I can see from the functions (in the link above) that they are output as list items but all my attempts to get this to work in a drop down have come to naught.
Is there a way to get the taxonomy terms (not sure if terms is the correct technical term here) for 'championship' to be selected/chosen via a dropdown as I have with my standard WordPress blog categories dropdown?
The reports (blog) and galleries (CPT) span several decades so navigating between years and championships quickly and easily is critical. Keeping the reports and galleries somewhat separate is also important.
I could hardcode these dropdowns into a new template part but that doesn't seem very 'WordPressy' so ideally I'm trying to find a smart solution but Custom Post Types don't seem to want to play ball.
All help and advice appreciated :)