'; } } add_action('wp_head', 'gutenbergtheme_pingback_header'); /* * Fatch related post data */ if (!function_exists('aari_related_posts')) : function aari_related_posts($display = 'category', $qty = 5, $images = true, $title = 'Related Posts') { global $post; $show = false; $post_qty = (int) $qty; switch ($display) : case 'tag': $tags = wp_get_post_tags($post->ID); if ($tags) { $show = true; $tag_ids = array(); foreach ($tags as $individual_tag) { $tag_ids[] = $individual_tag->term_id; } $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => $post_qty, 'ignore_sticky_posts' => 1 ); } break; default : $categories = get_the_category($post->ID); if ($categories) { $show = true; $category_ids = array(); foreach ($categories as $individual_category) { $category_ids[] = $individual_category->term_id; } $args = array( 'category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts' => $post_qty, 'ignore_sticky_posts' => 1 ); } endswitch; if ($show == true) { $related = new wp_query($args); if ($related->have_posts()) { $layout = ''; echo $layout; } wp_reset_query(); } } endif; /* * * * Wordpress number pagination * * */ if (!function_exists('aari_number_paging_nav')) : function aari_number_paging_nav() { // Don't print empty markup if there's only one page. if ($GLOBALS['wp_query']->max_num_pages < 2) { return; } $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; $pagenum_link = html_entity_decode(get_pagenum_link()); $query_args = array(); $url_parts = explode('?', $pagenum_link); if (isset($url_parts[1])) { wp_parse_str($url_parts[1], $query_args); } $pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link); $pagenum_link = trailingslashit($pagenum_link) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%'; // Set up paginated links. $links = paginate_links(array( 'base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('', 'aari'), 'next_text' => __('', 'aari'), )); if ($links) : $layout = '
'; $layout .= ''; $layout .= '
'; echo $layout; endif; } endif; /** * breadcrumbs */ if (!function_exists('aari_breadcrumbs')) : function aari_breadcrumbs() { /* === OPTIONS === */ $text['home'] = 'Home'; // text for the 'Home' link $text['category'] = 'Archive by Category "%s"'; // text for a category page $text['search'] = 'Search Results for "%s"'; // text for a search results page $text['tag'] = 'Posts Tagged "%s"'; // text for a tag page $text['author'] = 'Articles Posted by %s'; // text for an author page $text['404'] = 'Error 404'; // text for the 404 page $show_current = 1; // 1 - show current post/page/category title in breadcrumbs, 0 - don't show $show_on_home = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $show_home_link = 1; // 1 - show the 'Home' link, 0 - don't show $show_title = 1; // 1 - show the title for the links, 0 - don't show $delimiter = ' » '; // delimiter between crumbs $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb /* === END OF OPTIONS === */ global $post; $home_link = home_url('/'); $link_before = ''; $link_after = ''; $link_attr = ' rel="v:url" property="v:title"'; $link = $link_before . '%2$s' . $link_after; $post == is_singular() ? get_queried_object() : false; if ($post) { $parent_id = $parent_id_2 = $post->post_parent; } else { $parent_id = $parent_id_2 = 0; } $frontpage_id = get_option('page_on_front'); if (is_home() || is_front_page()) { if ($show_on_home == 1) echo ''; } else { echo ''; } } // end dimox_breadcrumbs() endif; /* * Change archive page title */ add_filter('get_the_archive_title', function ($title) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { $title = '' . get_the_author() . ''; } return $title; }); /* * Remove migrate js */ function aari_dequeue_jquery_migrate($scripts) { if (!is_admin() && !empty($scripts->registered['jquery'])) { $scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, ['jquery-migrate'] ); } } add_action('wp_default_scripts', 'aari_dequeue_jquery_migrate');