';
foreach($terms as $index => $term) {
if(in_array($term->term_id, $excepts_ids)) continue;
$term_link = get_term_link( $term );
if( is_wp_error($term_link) ) continue;
$terms_template[] = '
' . esc_html( $term->name ) . '';
}
$terms_template[] = '';
}
return implode("\r\t\n", $terms_template);
}
}
if( !function_exists('apola_has_post_terms') ) {
function apola_has_post_terms($id = null, $taxonomy = 'category', $excepts_ids = array()) {
if(is_null($id) || !is_numeric($id)) return false;
$terms = get_the_terms(intval($id), $taxonomy);
if(!is_array($terms) || !count($terms)) return false;
foreach($terms as $index => $term) {
if(in_array($term->cat_ID, $excepts_ids)) unset($terms[$index]);
}
return count($terms);
}
}
/* Isotope filter
/* --------------------------------------------------------------------- */
if( !function_exists('apola_display_filter') ) {
function apola_display_filter($posts = array(), $filter_element_id, $default_caption_for_all_posts = 'All', $taxonomy = 'category', $post_id_key = null) {
$terms = array();
foreach($posts as $post) {
if($post instanceof WP_Post) {
$post_terms = get_the_terms($post->ID, $taxonomy);
}
elseif(is_array($post) && isset($post_id_key)) {
$post_terms = get_the_terms($post[$post_id_key], $taxonomy);
}
if(isset($post_terms) && is_array($post_terms) && count($post_terms)) {
foreach($post_terms as $term) {
if(!in_array($term->slug, $terms)) array_push($terms, $term->slug);
}
}
}
?>
id="comment-">
comment_approved == '0') : ?>
getThemeOption(sprintf('apola-logo-%s-%s', $type, $color_scheme));
if(!is_array($logo)) {
$logo = array(
'url' => sprintf('%s/assets/images/logo-vertical-dark.png', APOLA_TEMPLATE_DIRECTORY_URI)
);
}
?>
getThemeOption('page-loader-state', '0');
$page_loader_logo = $Apola->getThemeOption('page-loader-logo');
if($page_loader_state == '1') : ?>
';
bcn_display();
echo '';
}
}
}
/* Pagination
/* --------------------------------------------------------------------- */
if(!function_exists('apola_pagination')) {
function apola_pagination($args = array()) {
if(isset($args['type'])) unset($args['type']);
$defaults = array(
'prev_next' => false,
'type' => 'array'
);
$pagination = paginate_links(array_merge($defaults, $args));
if(is_array($pagination)) : ?>
getThemeOption(sprintf('apola-social-links-%s', $link));
if(empty($link_url)) continue;
$links_prepared[$link] = array(
'url' => $link_url,
'icon-class' => sprintf('fa-%s', $link)
);
}
if(count($links_prepared)) :
?>
$location,
'menu' => 'primary',
'menu_class' => 'apo-navigation',
'container' => 'nav',
'container_class' => 'apo-navigation-container'
);
if(has_nav_menu($location)) {
wp_nav_menu(array_merge($defaults, $args));
}
}
}
/* Dump helper
/* ---------------------------------------------------------------------- */
if(!function_exists('apola_dump')) {
function apola_dump($value) {
echo "";
if(is_array($value)) print_r($value);
else var_dump($value);
echo "
";
}
}
/* AJAX handlers
/* ---------------------------------------------------------------------- */
if(!function_exists('apola_show_item_info_modal')) {
function apola_show_item_info_modal() {
check_ajax_referer('apola-ajax-nonce', 'AJAX_token');
$data = $_GET['data'];
if(!isset($data['post_type'])) {
die();
}
ob_start();
get_template_part('template-parts/modals/apola-modal-item-info', preg_replace('/apola-/', '', $data['post_type']));
echo ob_get_clean();
wp_die();
}
}
if(wp_doing_ajax()) {
add_action('wp_ajax_show_item_info_modal', 'apola_show_item_info_modal');
add_action('wp_ajax_nopriv_show_item_info_modal', 'apola_show_item_info_modal');
}
/* Checks whether post has pingbacks and trackbacks.
/* ---------------------------------------------------------------------- */
if( !function_exists( 'apola_has_post_pings' ) ) {
function apola_has_post_pings( $post_id = null ) {
if( is_null($post_id) ) return false;
$comments = get_comments(array(
'status' => 'approve',
'type' => 'pings',
'post_id' => $post_id
));
return boolval(count($comments));
}
}
/* Language switcher
/* ---------------------------------------------------------------------- */
if(!function_exists('apola_language_switcher')) {
function apola_language_switcher() {
$languages = apply_filters('wpml_active_languages', NULL, 'skip_missing=0');
$active_language = null;
if(count($languages)) : ?>
$font_weights) {
/* Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language. */
$font_state = sprintf( _x( 'on', '%s font: on or off', 'apola' ), $font );
if ( 'off' !== $font_state ) {
$font_family[] = sprintf('%s:%s', $font, implode(',', $font_weights));
}
}
}
if($font_family) {
$fonts_url = add_query_arg(array(
'family' => urlencode(implode('|', $font_family)),
'subset' => urlencode(implode(',', $charsets))
), 'https://fonts.googleapis.com/css');
}
return esc_url_raw($fonts_url);
}
}
?>