ID, 'blogus-meta-content-alignment', true); if (!empty($post_options)) { $page_layout = $post_options; } else { $page_layout = $global_alignment; } } return $classes; } add_filter('body_class', 'blogus_body_classes'); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function blogus_pingback_header() { if (is_singular() && pings_open()) { echo ''; } } add_action('wp_head', 'blogus_pingback_header'); /** * Returns posts. * * @since blogus 1.0.0 */ if (!function_exists('blogus_get_posts')): function blogus_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('blogus_get_block')) : /** * * @param null * * @return null * * @since Blogus 1.0.0 * */ function blogus_get_block($block = 'grid', $section = 'post') { get_template_part('inc/ansar/hooks/blocks/block-' . $section, $block); } endif; /* Display Breadcrumbs */ if (!function_exists('blogus_excerpt_length')) : /** * Simple excerpt length. * * @since 1.0.0 */ function blogus_excerpt_length($length) { if (is_admin()) { return $length; } return 15; } endif; add_filter('excerpt_length', 'blogus_excerpt_length', 999); /* Display Breadcrumbs */ if (!function_exists('blogus_excerpt_more')) : /** * Simple excerpt more. * * @since 1.0.0 */ function blogus_excerpt_more($more) { return '...'; } endif; add_filter('excerpt_more', 'blogus_excerpt_more'); /** * @param $post_id * @param string $size * * @return mixed|string */ function blogus_get_freatured_image_url($post_id, $size = 'blogus-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('blogus_categories_show')): function blogus_categories_show() { ?>