Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'pre_get_posts', function( $query ){
- if( $query->is_archive() && $query->is_main_query() ){
- $query->set( 'post_type', array( 'post', 'video' ) );
- }
- }, 10, 1 );
- /**
- *
- * Filter the Archive widget
- *
- */
- add_filter( 'widget_archives_dropdown_args', function( $args, $instance ){
- return array_merge( $args, array(
- 'post_type' => 'video'
- ) );
- }, 10, 2 );
- /**
- *
- * Filter the Category widget
- *
- */
- add_filter( 'widget_categories_dropdown_args', function( $args, $instance ){
- return array_merge( $args, array(
- 'taxonomy' => 'categories',
- 'value_field' => 'slug',
- 'class' => 'video-category-select'
- ) );
- }, 10, 2 );
- add_action( 'wp_footer', function(){
- ?>
- <script type="text/javascript">
- jQuery( '.video-category-select' ).on( 'change', function(e){
- var slug = jQuery(this).val();
- window.location.href = '<?php echo trailingslashit( home_url( 'categories' ) ); ?>' + slug;
- } );
- </script>
- <?php
- } );
- add_filter( 'widget_text', function( $text ){
- return do_shortcode( $text );
- }, 10, 2 );
Add Comment
Please, Sign In to add comment