/* Allow Media File Size on Upload */
@ini_set( 'upload_max_size' , '180M' );
@ini_set( 'post_max_size', '180M');
@ini_set( 'max_execution_time', '400' );
/* Allow Post Thumbnails */
add_theme_support('post-thumbnails');
/* Allow SVG Uploading */
function bheku_alow_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}; add_filter('upload_mimes', 'bheku_alow_mime_types');
/*
* Image Handling
* !
*/
function bheku_add_image_sizes() {
add_image_size( 'xs', 150, 9999 );
add_image_size( 'xl', 1280, 9999 );
add_image_size( 'xxl', 1440, 9999 );
}; add_action( 'after_setup_theme', 'bheku_add_image_sizes' );
function bheku_add_image_size_names( $sizes ) {
return array_merge(
$sizes,
array(
'xs' => __( 'Extra Small' ),
'xl' => __( 'Extra Large' ),
'xxl' => __( 'Large Format' ),
)
);
}; add_filter( 'image_size_names_choose', 'bheku_add_image_size_names' );
function bheku_add_responsive_image_sizes($sizes, $size) {
$width = $size[0];
// default to return if condition is not met
return '(max-width: ' . $width . 'px) 100vw, ' . $width . 'px';
}; add_filter('wp_calculate_image_sizes', 'bheku_add_responsive_image_sizes', 10 , 2);
function bheku_declare_responsive_image_sizes($attr, $attachment, $size) {
return $attr;
}; add_filter('wp_get_attachment_image_attributes', 'bheku_declare_responsive_image_sizes', 10 , 3);
Notable research papers at Dadhaleh Institute
if ( get_post_type() == 'digest' ) $is_digest = true;
if ( get_post_type() == 'development' ) $is_development = true;
if ( get_post_type() == 'resource' ) $is_resource = true;
if ( get_post_type() == 'topic' ) $is_topic = true;
?>
Clinical Public Health, Italy
development
global $bheku_post_types_formatted_taxonomies;
$tax_group = [ 'relation' => 'OR' ];
foreach ( $bheku_post_types_formatted_taxonomies as $tax ) {
if ( $tax == 'topic' || $tax == 'organisation' ) continue;
if ( '' !== bheku_entry_terms(get_the_ID(), $tax, false, 'list') ) {
$tax_group[] = [
'taxonomy' => $tax,
'field' => 'name',
'terms' => explode( ',', bheku_entry_terms(get_the_ID(), $tax, false, 'list') ),
'compare' => 'LIKE',
];
}
}
if ( $tax_group == [ 'relation' => 'OR' ] ) $tax_group = [];
$tax_query = new WP_Tax_Query( $tax_group );
// echo '';
// print_r($tax_group);
// echo '';
$meta_group = [ 'relation' => 'OR' ];
foreach ( $bheku_post_types_formatted_taxonomies as $tax ) {
if ( ( $tax == 'topic' || $tax == 'organisation' ) && bheku_entry_terms(get_the_ID(), $tax, false, 'list') !== '' ) {
$terms = explode( ',', bheku_entry_terms(get_the_ID(), $tax, false, 'id') );
foreach ($terms as $key => $term) {
$meta_group[] = [
'key' => $tax.'_id',
'value' => $term,
'compare' => 'LIKE',
];
}
}
}
if ( $meta_group == [ 'relation' => 'OR' ] ) $meta_group = [];
$meta_query = new WP_Meta_Query( $meta_group );
// echo '';
// print_r($meta_query);
// echo '';
$arg_similar_posts = array(
'numberposts' => -1,
'post_type' => get_post_type(),
'fields' => 'ids',
'exclude' => get_the_ID(),
'order_by' => 'post_date',
'order' => 'asc',
'meta_query' => $meta_group,
'tax_query' => $tax_group,
);
$similar_posts = get_posts( $arg_similar_posts );
// echo '';
// print_r($arg_development);
// print_r($similar_posts);
// echo '';
?>