Hot answers tagged

5

If I am understanding you have a taxonomy that is shared across multiple post types? And you want to make a custom template for each post type using the Wordpress's templating system. Which isn't possible. What you could do is add conditionals to your taxonomy-disrupt-categories.php to check what the current post type is and load different template parts ...


2

In each of your hooks & filters handlers, in addition to checking for archive conditions, check for a custom query var that you can then set for a custom/manual query. For example, where you might have: function wpse_223991_pre_get_posts( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_post_type_archive( 'my_post_type' ) ...


2

Make use of custom parameter, lets call it wpse__current_year, which will accept two values, true (includes current year) and false (excludes current year). Lets incorporate that function show_monthly_archive( $post_type ) { $current_year_args = array( 'type' => 'monthly', 'limit' => '12', ...


2

Probably the most "WordPress-y" approach to such a problem is to store the date of your 'event' custom post-type in the post's metadata. Enabling users to set meta-data on a post is usually accomplished by using the 'register_meta_box_cb' argument to the register_post_type() function to add an extra "meta box" interface to the pages for creating or editing a ...


1

You can use Options API or Setting API to store the data in the database. Write a plugin to create a meta box for the introduction text and show that text on the archive-unicorn.php. Or you can utilize the description parameter when you register_post_type and print it in the archive-unicorn.php like this: $unicorn_obj = get_post_type_object('unicorn'); if ...


1

You can try to build some options custom page to allow users to change some text. there are many plugins for easily creating that functionality. I will suggest you the most popular - https://www.advancedcustomfields.com/add-ons/options-page/ You can use the following code with ACF PRO: /** * Create ACF setting page under Campaign CPT menu * * @since ...



Only top voted, non community-wiki answers of a minimum length are eligible