ID, 'blogarise-meta-content-alignment', true); if (!empty($post_options)) { $page_layout = $post_options; } else { $page_layout = $global_alignment; } } return $classes; } add_filter('body_class', 'blogarise_body_classes'); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blogarise_pingback_header() { if (is_singular() && pings_open()) { echo ''; } } add_action('wp_head', 'blogarise_pingback_header'); /** * Returns posts. * * @since blogarise 1.0.0 */ if (!function_exists('blogarise_get_posts')): function blogarise_get_posts($number_of_posts, $category = '0') { $ins_args = array( 'post_type' => 'post', 'posts_per_page' => absint($number_of_posts), 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => true ); $category = isset($category) ? $category : '0'; if (absint($category) > 0) { $ins_args['cat'] = absint($category); } $all_posts = new WP_Query($ins_args); return $all_posts; } endif; if (!function_exists('blogarise_get_block')) : /** * * @param null * * @return null * * @since blogarise 1.0.0 * */ function blogarise_get_block($block = 'grid', $section = 'post') { get_template_part('inc/ansar/hooks/blocks/block-' . $section, $block); } endif; if (!function_exists('blogarise_archive_title')) : /** * * @param null * * @return null * * @since blogarise 1.0.0 * */ function blogarise_archive_title($title) { if (is_category()) { $title = single_cat_title('', false); } elseif (is_tag()) { $title = single_tag_title('', false); } elseif (is_author()) { $title = '' . get_the_author() . ''; } elseif (is_post_type_archive()) { $title = post_type_archive_title('', false); } elseif (is_tax()) { $title = single_term_title('', false); } return $title; } endif; add_filter('get_the_archive_title', 'blogarise_archive_title'); /** * @param $post_id * @param string $size * * @return mixed|string */ function blogarise_get_freatured_image_url($post_id, $size = 'blogarise-featured') { if (has_post_thumbnail($post_id)) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size); $url = $thumb !== false ? '' . $thumb[0] . '' : '""'; } else { $url = ''; } return $url; } if (!function_exists('blogarise_categories_show')): function blogarise_categories_show() { ?>