| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/glaza-core/includes/ |
Upload File : |
<?php
/**
* @param $args
*
* @return mixed
* tag filter
*/
if ( ! function_exists( 'glaza_widget_tag_cloud_args' ) ) {
function glaza_widget_tag_cloud_args( $args ) {
$args['largest'] = 1;
$args['smallest'] = 1;
return $args;
}
}
add_filter( 'widget_tag_cloud_args', 'glaza_widget_tag_cloud_args' );
/**
* add span tag for default categories widget
*/
if ( ! function_exists( 'glaza_cat_widget_span' ) ) {
function glaza_cat_widget_span( $str ) {
$pos = strpos( $str, '</a> (' );
if ( false != $pos ) {
$str = str_replace( '</a> (', '<span class="count">', $str );
$str = str_replace( ')', '</span></a>', $str );
}
return $str;
}
}
;
add_filter( 'wp_list_categories', 'glaza_cat_widget_span' );
/**
* add span tag for default archive widget
*/
if ( ! function_exists( 'glaza_archives_widget_span' ) ) {
function glaza_archives_widget_span( $str ) {
$pos = strpos( $str, '</a> (' );
if ( false != $pos ) {
$str = str_replace( '</a> (', '<span class="count">', $str );
$str = str_replace( ')', '</span></a>', $str );
}
return $str;
}
}
add_filter( 'get_archives_link', 'glaza_archives_widget_span' );
/**
* @param $redirect_url
*
* @return bool
* permalinks
*/
if ( ! function_exists( 'glaza_pagination_redirect' ) ) {
function glaza_pagination_redirect( $redirect_url ) {
global $wp_query;
if ( is_page() && ! is_feed() && isset( $wp_query->queried_object ) && get_query_var( 'page' ) && 'page-blank.php' == get_page_template_slug( $wp_query->queried_object->ID ) ) {
return false;
}
return $redirect_url;
}
}
add_filter( 'redirect_canonical', 'glaza_pagination_redirect', 10 );
/**
* @return bool
* remove search page
*/
if ( ! function_exists( 'glaza_filter_search' ) ) {
function glaza_filter_search() {
global $wp_query;
global $wp_post_types;
$search_page = glaza_get_option( 'search_page' );
if ( ! empty( $search_page ) && ! is_admin() && $wp_query->is_main_query() && $wp_query->is_search() ) {
$wp_post_types['page']->exclude_from_search = true;
}
return false;
}
}
add_action( 'pre_get_posts', 'glaza_filter_search' );
/**
* bookmarklet
*/
if ( ! function_exists( 'glaza_bookmarklet_icon' ) ) :
function glaza_bookmarklet_icon() {
$apple_icon = glaza_get_option( 'icon_touch_apple' );
$metro_icon = glaza_get_option( 'icon_touch_metro' );
if ( ! empty( $apple_icon['url'] ) ) : ?>
<link rel="apple-touch-icon" href="<?php echo esc_url( $apple_icon['url'] ); ?>"/>
<?php endif;
if ( ! empty( $metro_icon['url'] ) ) : ?>
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="<?php echo esc_url( $metro_icon['url'] ); ?>"/>
<?php endif;
}
endif;
add_action( 'wp_head', 'glaza_bookmarklet_icon', 10 );
/**
* @param $query
* post per pages
*/
if ( ! function_exists( 'glaza_blog_posts_per_page' ) ) {
function glaza_blog_posts_per_page( $query ) {
if ( is_admin() ) {
return false;
}
if ( $query->is_main_query() ) {
if ( $query->is_search() || $query->is_category() || $query->is_tag() || $query->is_author() || $query->is_archive() ) {
$query->set( 'post_status', 'publish' );
}
if ( $query->is_home() ) {
$blog_index_posts_per_page = glaza_get_option( 'blog_index_posts_per_page' );
if ( ! empty( $blog_index_posts_per_page ) ) {
$query->set( 'posts_per_page', $blog_index_posts_per_page );
}
} elseif ( $query->is_search() ) {
$search_posts_per_page = glaza_get_option( 'search_posts_per_page' );
if ( ! empty( $search_posts_per_page ) ) {
$query->set( 'posts_per_page', $search_posts_per_page );
}
} elseif ( $query->is_category() ) {
$cat_id = $query->get_queried_object_id();
$cat_cf_options = get_option( 'glaza_taxonomy_cat_options' ) ? get_option( 'glaza_taxonomy_cat_options' ) : array();
if ( ! empty( $cat_cf_options[ $cat_id ]['cat_posts_per_page'] ) ) {
$cat_posts_per_page = $cat_cf_options[ $cat_id ]['cat_posts_per_page'];
} else {
$cat_posts_per_page = glaza_get_option( 'cat_posts_per_page' );
}
if ( ! empty( $cat_posts_per_page ) ) {
$query->set( 'posts_per_page', $cat_posts_per_page );
}
} elseif ( $query->is_tag() ) {
$tag_posts_per_page = glaza_get_option( 'tag_posts_per_page' );
if ( ! empty( $tag_posts_per_page ) ) {
$query->set( 'posts_per_page', $tag_posts_per_page );
}
} elseif ( $query->is_author() ) {
$author_posts_per_page = glaza_get_option( 'author_posts_per_page' );
if ( ! empty( $author_posts_per_page ) ) {
$query->set( 'posts_per_page', $author_posts_per_page );
}
} elseif ( $query->is_archive() ) {
$archive_posts_per_page = glaza_get_option( 'archive_posts_per_page' );
if ( ! empty( $archive_posts_per_page ) ) {
$query->set( 'posts_per_page', $archive_posts_per_page );
}
}
}
}
}
add_action( 'pre_get_posts', 'glaza_blog_posts_per_page' );