Tag Info

Hot answers tagged

2

Edit If this is your goal: I want to use the Wordpress gallery to show all pictures of one category in a gallery (on a fixed page), which I do not have to update all the time by inserting the pictures manually. Then the easiest way to accomplish it is via custom page template. Create the template Copy your page.php template file, and name it ...


2

Have you try: function my_custom_show_pages_in_category( $query ){ if( $query->is_category() && $query->is_main_query() ){ $query->set('post_type', array('post', 'page' ) ) ; } } add_action('pre_get_posts', 'my_custom_show_pages_in_category' ); See more: Codex


1

Problem is solved. Just need to add 'hide_empty' => false, to the array. Like this : wp_dropdown_categories( array ( 'orderby' => 'name', // ID of the already selected category: 'selected' => 4, 'hide_empty' => false, // If no category is selected: 'show_option_none' => 'Choose one' ) ...


1

There are 3 parts to making this work. Register the post type with correct rewrite slug and archive. We add the %category% rewrite tag to the slug so we can swap in the selected category. We also specify the archive name explicitly. I've omitted the rest of the register_post_type arguments here, the rest can be as-is in your own example. 'rewrite' => ...



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