ANY PROBLEMS WITH THIS CODE =

<?php
/**
 * GeneratePress child theme functions and definitions.
 *
 * Add your custom PHP in this file.
 * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
 */


/* ADD IMAGE SIZE */

if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );

        if ( function_exists( 'add_image_size' ) ) {
        add_image_size( 'galiano', 550, 374, true );        
}

add_action('generate_paging_navigation','generate_pagenavi_integration');
function generate_pagenavi_integration()
{
    wp_pagenavi();
}




/* TAXONOMIES */

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_actress_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it actress for your posts

function create_actress_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Actress', 'taxonomy general name' ),
    'singular_name' => _x( 'Actress', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Actress' ),
    'all_items' => __( 'All Actress' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit Actress' ), 
    'update_item' => __( 'Update Actress' ),
    'add_new_item' => __( 'Add New Actress' ),
    'new_item_name' => __( 'New Actress Name' ),
    'menu_name' => __( 'Actress' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('actress',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'actress' ),
  ));

}

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_studio_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it studio for your posts

function create_studio_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'studio', 'taxonomy general name' ),
    'singular_name' => _x( 'studio', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search studio' ),
    'all_items' => __( 'All studio' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit studio' ), 
    'update_item' => __( 'Update studio' ),
    'add_new_item' => __( 'Add New studio' ),
    'new_item_name' => __( 'New studio Name' ),
    'menu_name' => __( 'studio' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('studio',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'studio' ),
  ));
}

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_series_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it series for your posts

function create_series_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Series', 'taxonomy general name' ),
    'singular_name' => _x( 'Series', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Series' ),
    'all_items' => __( 'All Series' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit Series' ), 
    'update_item' => __( 'Update Series' ),
    'add_new_item' => __( 'Add New Series' ),
    'new_item_name' => __( 'New Series Name' ),
    'menu_name' => __( 'Series' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('series',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'series' ),
  ));
}

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_actor_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it actor for your posts

function create_actor_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Actor', 'taxonomy general name' ),
    'singular_name' => _x( 'Actor', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Actor' ),
    'all_items' => __( 'All Actor' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit Actor' ), 
    'update_item' => __( 'Update Actor' ),
    'add_new_item' => __( 'Add New Actor' ),
    'new_item_name' => __( 'New Actor Name' ),
    'menu_name' => __( 'Actor' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('actor',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'actor' ),
  ));

}

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_director_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it director for your posts

function create_director_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Director', 'taxonomy general name' ),
    'singular_name' => _x( 'Director', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Director' ),
    'all_items' => __( 'All Director' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit Director' ), 
    'update_item' => __( 'Update Director' ),
    'add_new_item' => __( 'Add New Director' ),
    'new_item_name' => __( 'New Director Name' ),
    'menu_name' => __( 'Director' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('director',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'director' ),
  ));

}


//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_maker_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it maker for your posts

function create_maker_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Maker', 'taxonomy general name' ),
    'singular_name' => _x( 'Maker', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Maker' ),
    'all_items' => __( 'All Maker' ),
    'most_used_items' => null,
	'parent_item' => null,
	'parent_item_colon' => null,
    'edit_item' => __( 'Edit Maker' ), 
    'update_item' => __( 'Update Maker' ),
    'add_new_item' => __( 'Add New Maker' ),
    'new_item_name' => __( 'New Maker Name' ),
    'menu_name' => __( 'Maker' ),
  ); 	

// Now register the taxonomy

  register_taxonomy('maker',array('post'), array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'maker' ),
  ));

}


function set_default_meta($post_ID){
    $current_field_value = get_post_meta($post_ID,'Release Date',true);
	$current_field_value = get_post_meta($post_ID,'large-image',true);

    $default_meta = ''; // value
    if ($current_field_value == '' && !wp_is_post_revision($post_ID)){
            add_post_meta($post_ID,'Release Date',$default_meta,true);
			add_post_meta($post_ID,'large-image',$default_meta,true);

    }
    return $post_ID;
}
add_action('wp_insert_post','set_default_meta');





/// 1/2 COLUMN
	function twocol_one($atts, $content = null) {
		return '<div class="twocol-one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("twocol_one", "twocol_one");
	
/// 1/2 COLUMN
	function twocol_one_last($atts, $content = null) {
		return '<div class="twocol-one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("twocol_one_last", "twocol_one_last");
	
/// 1/3 COLUMN
	function threecol_one($atts, $content = null) {
		return '<div class="threecol_one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("threecol_one", "threecol_one");
 
/// 1/3 COLUMN
	function threecol_one_last($atts, $content = null) {
		return '<div class="threecol_one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("threecol_one_last", "threecol_one_last");

/// 1/4 COLUMN
	function fourcol_one($atts, $content = null) {
		return '<div class="fourcol_one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("fourcol_one", "fourcol_one");
 
/// 1/4 COLUMN
	function fourcol_one_last($atts, $content = null) {
		return '<div class="fourcol_one">'.do_shortcode($content).'</div>';
	}
	add_shortcode ("fourcol_one_last", "fourcol_one_last");

/// DISABLE WP-EMBED
function my_deregister_scripts(){
  wp_deregister_script( 'wp-embed' );
}
add_action( 'wp_footer', 'my_deregister_scripts' );

/// EXCLUDE HOME CATS
function exclude_category_home( $query ) {
        if (is_page(29047)) return;
if ( $query->is_home ) {
$query->set( 'cat', '-783,-41,-2026,-2754,-15617' );
}
return $query;
}

add_filter( 'pre_get_posts', 'exclude_category_home' );



/* DISABLE MEDIUM LARGE */

add_filter( 'intermediate_image_sizes', function( $sizes )
{
    return array_filter( $sizes, function( $val )
    {
        return 'medium_large' !== $val; // Filter out 'medium_large'
    } );
} );


/* BLOGPHP DESIGN */

function get_custom_category_template($single_template) {

     if ( in_category( 'blog' ) ) {
          $new_template = locate_template( array( 'blog.php' ) );
          if ( '' != $new_template ) {
            $single_template = $new_template ;
          }
     }
     return $single_template;
}
add_filter( 'single_template', 'get_custom_category_template' );










/*Create custom MetaBox*/
function CreateTextfield()
{
$screen = 'post';
add_meta_box('my-meta-box-id','Large image','displayeditor',$screen,'normal','high');
}
add_action( 'add_meta_boxes', 'CreateTextfield' ) ;

/*Display PostMetabox*/
function displayeditor($post)
{
global $wbdb;
$metaeditor = 'metaeditor';
$displayeditortext = get_post_meta($post->ID, "large-image", $single =true );  
?>
  <style>
.mgg img {
    border: none;
    max-width: 33%;
    height: auto;
    width: auto;
    vertical-align: top;
}</style>
<div class="mgg">
    <img src="<?php echo $displayeditortext;?>" /></div>
   <?php        
}


// remove dashicons in frontend to non-admin 
    function wpdocs_dequeue_dashicon() {
        if (current_user_can( 'update_core' )) {
            return;
        }
        wp_deregister_style('dashicons');
    }
    add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' );


   add_filter( 'generate_navigation_search_output', function() {
    return sprintf( // WPCS: XSS ok, sanitization ok.
        '<form method="get" class="search-form navigation-search" action="%1$s">
            <input placeholder="Type to search" autocomplete="off" type="search" class="search-field" value="" name="s" title="%2$s" />
        </form>',
        esc_url( home_url( '/' ) ),
        esc_attr_x( 'Search', 'label', 'generatepress' )
    );
} ); 





//desactivar user toolbar
if(current_user_can('subscriber')) {
	add_filter('show_admin_bar', '__return_false');
}

add_action('after_setup_theme','generate_copyright_remove_default_message');
function generate_copyright_remove_default_message()
{
		
	remove_action( 'generate_credits', 'generate_add_footer_info' );
	remove_action( 'generate_copyright_line','generate_add_login_attribution' );
}

# User toolbar
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
  show_admin_bar(false);
}
}


	// Only display posts on search results page
function wpb_search_filter($query)
{
if ($query->is_search)
{
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','wpb_search_filter');





/**
 * Stores views of different time periods as meta keys.
 *
 * @author  @migueleste / @radgh
 * @link    https://wordpress.org/support/topic/how-to-sort-a-custom-query-by-views-all-time-monthly-weekly-or-daily/
 * @param   int     $postid     The ID of the current post/page/custom post type.
 */
add_action( 'wpp_post_update_views', 'custom_wpp_update_postviews' );
function custom_wpp_update_postviews($postid) {
	// Accuracy:
	//   10  = 1 in 10 visits will update view count. (Recommended for high traffic sites.)
	//   30 = 30% of visits. (Medium traffic websites)
	//   100 = Every visit. Creates many db write operations every request.
	$accuracy = 4;
	if ( function_exists('wpp_get_views') && (mt_rand(0,100) < $accuracy) ) {
		// Remove or comment out lines that you won't be using!!
		update_post_meta( $postid, 'views_total', wpp_get_views( $postid, 'all', false ) );
		update_post_meta( $postid, 'views_monthly', wpp_get_views( $postid, 'monthly', false ) );
	}
}
// Filter to "pre_get_posts" to change query vars
add_action( 'pre_get_posts', 'dp_custom_get_posts' );
function dp_custom_get_posts( $query ) {
	if(is_admin())
		return;	
	$orderby = $query->get('orderby');
	$order = $query->get('order');
	// Reset query vars based orderby parameter
if($orderby == 'views') {	
		$query->set('orderby', 'meta_value_num');
		$query->set('meta_key', 'views_total');
		$query->set('order', 'DESC');
	} 
elseif($orderby == 'views-monthly') {	
		$query->set('orderby', 'meta_value_num');
		$query->set('meta_key', 'views_monthly');
		$query->set('order', 'DESC');
	} 
elseif($orderby == 'likes-month') {	
		$post__in = wp_ulike_get_popular_items_ids(array(
         'type' => 'post',
		 'period' => array(
         'interval_value' => 1,
         'interval_unit' => 'month'
           ),
         'limit' => 480,
         ) );
		$query-> set('post__in', $post__in);
        $query-> set('orderby', 'post__in');
        return $query;
	} 
elseif($orderby == 'likes') {	
		$post__in = wp_ulike_get_popular_items_ids(array(
         'type' => 'post',
		 'status'    => 'like',
		 'period' => array(
         'interval_value' => 7,
         'interval_unit' => 'year'
           ),
         'limit' => 9600,
         ));
        $query-> set('post__in', $post__in);
        $query-> set('orderby', 'post__in');
        return $query;
	} 
elseif($orderby == 'likes-today') {	
		$post__in = wp_ulike_get_popular_items_ids(array(
         'type' => 'post',
		 'period' => array(
         'interval_value' => 2,
         'interval_unit' => 'day'
           ),
         'limit' => 0,
         ));
		$query-> set('post__in', $post__in);
        $query-> set('orderby', 'post__in');
        return $query;
	} 
elseif($orderby == 'dislikes') {	
		$post__in = wp_ulike_get_popular_items_ids(array(
         'type' => 'post',
		 'status'    => 'dislike',
		 'period' => array(
         'interval_value' => 7,
         'interval_unit' => 'year'
           ),
         'limit' => 9600,
         ));
		$query-> set('post__in', $post__in);
        $query-> set('orderby', 'post__in');
        return $query;
	} 
elseif($orderby == 'rdate') {	
		$query->set('meta_key', 'Release Date');
		$query->set('orderby', 'meta_value');
		$query->set('order', 'DESC');		
} 
elseif($orderby == 'title' && !$order) {
		// If order by title, and no order specified, set "ASC" as default order.
		$query->set('order', 'ASC');
	}
	}
	


function wpb_studs() { 
$terms = get_terms( 'studio', array(
        'orderby' => 'count',
 		'order' => 'DESC','DESC',
 	    'number'=> '18',
));
	echo '<h2 class="widget-title">Popular Labels</h2>';
echo '<ul>';
foreach ( $terms as $term ) {
    $term_link = get_term_link( $term );
    if ( is_wp_error( $term_link ) ) {
        continue; }
    echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . ' <span>(' . $term->count . ')</span></a></li>'; }
	echo '</ul>'; 
    echo '<ul><li><a href="https://jav.guru/jav-studio-list/">All Labels</a></li></ul>';
}
add_shortcode('studs', 'wpb_studs');

function wpb_makerss() { 
$terms = get_terms( 'maker', array(
        'orderby' => 'count',
 		'order' => 'DESC','DESC',
 	    'number'=> '18',
));
	echo '<h2 class="widget-title">AV Makers:</h2>';
echo '<ul>';
foreach ( $terms as $term ) {
    $term_link = get_term_link( $term );
    if ( is_wp_error( $term_link ) ) {
        continue; }
    echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . ' <span>(' . $term->count . ')</span></a></li>'; }
	echo '</ul>'; 
   echo '<ul><li><a href="https://jav.guru/jav-makers-list/">All Makers</a></li></ul>';
}
add_shortcode('makerss', 'wpb_makerss');

function wpb_actss() { 
$terms = get_terms( 'actress', array(
        'orderby' => 'count',
 		'order' => 'DESC','DESC',
 	    'number'=> '18',
));
		echo '<h2 class="widget-title">AV Actress</h2>';
echo '<ul>';
foreach ( $terms as $term ) {
    $term_link = get_term_link( $term );
    if ( is_wp_error( $term_link ) ) {
        continue; }
    echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . ' <span>(' . $term->count . ')</span></a></li>'; }
	echo '</ul>'; 
    echo '<ul><li><a href="https://jav.guru/jav-actress-list/">All actress list</a></li></ul>';
}
add_shortcode('actss', 'wpb_actss');

function wpb_tagss() {      
$tags = get_tags( array('orderby' => 'count', 'order' => 'DESC','DESC', 'number'=>'18') );
	echo '<h2 class="widget-title">Tags:</h2>';
foreach ( (array) $tags as $tag ) {
echo '<li><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . ' <span>(' . $tag->count . ')</span> </a></li>'; }
	echo '<li><a href="https://jav.guru/jav-tags-list/">All tags</a></li>';
}
add_shortcode('tagss', 'wpb_tagss');




function wpb_image_editor_default_to_gd( $editors ) {
    $gd_editor = 'WP_Image_Editor_GD';
    $editors = array_diff( $editors, array( $gd_editor ) );
    array_unshift( $editors, $gd_editor );
    return $editors;
}
add_filter( 'wp_image_editors', 'wpb_image_editor_default_to_gd' );

add_filter('comment_flood_filter', '__return_false');