';
}
}
add_action( 'wp_head', 'blog_rider_pingback_header' );
/**
* Get an array of post id and title.
*
*/
function blog_rider_get_post_choices() {
$choices = array( '' => esc_html__( '--Select Post--', 'blog-rider' ) );
$args = array( 'numberposts' => -1, );
$posts = get_posts( $args );
foreach ( $posts as $post ) {
$id = $post->ID;
$title = $post->post_title;
$choices[ $id ] = $title;
}
return $choices;
}
if( !function_exists( 'blog_rider_get_page_choices' ) ) :
/*
* Function to get pages
*/
function blog_rider_get_page_choices() {
$pages = get_pages();
$page_list = array();
$page_list[0] = esc_html__( '--Select Page--', 'blog-rider' );
foreach( $pages as $page ){
$page_list[ $page->ID ] = $page->post_title;
}
return $page_list;
}
endif;
/**
* Get an array of cat id and title.
*
*/
if( !function_exists( 'blog_rider_get_post_cat_choices' ) ) :
/*
* Function to get categories
*/
function blog_rider_get_post_cat_choices() {
$categories = get_terms( 'category' );
$choices = array('' => esc_html__( '--Select Category--', 'blog-rider' ));
foreach( $categories as $category ) {
$choices[$category->term_id] = $category->name;
}
return $choices;
}
endif;
/**
* Checks to see if we're on the homepage or not.
*/
function blog_rider_is_frontpage() {
return ( is_front_page() && ! is_home() );
}
/**
* Checks to see if Static Front Page is set to "Your latest posts".
*/
function blog_rider_is_latest_posts() {
return ( is_front_page() && is_home() );
}
/**
* Checks to see if Static Front Page is set to "Posts page".
*/
function blog_rider_is_frontpage_blog() {
return ( is_home() && ! is_front_page() );
}
/**
* Checks to see if the current page displays any kind of post listing.
*/
function blog_rider_is_page_displays_posts() {
return ( blog_rider_is_frontpage_blog() || is_search() || is_archive() || blog_rider_is_latest_posts() );
}
/**
* Shows a breadcrumb for all types of pages. This is a wrapper function for the Breadcrumb_Trail class,
* which should be used in theme templates.
*
* @since 1.0.0
* @access public
* @param array $args Arguments to pass to Breadcrumb_Trail.
* @return void
*/
function blog_rider_breadcrumb( $args = array() ) {
$breadcrumb = apply_filters( 'breadcrumb_trail_object', null, $args );
if ( ! is_object( $breadcrumb ) )
$breadcrumb = new Breadcrumb_Trail( $args );
return $breadcrumb->trail();
}
/**
* Pagination in archive/blog/search pages.
*/
function blog_rider_posts_pagination() {
$archive_pagination = get_theme_mod( 'blog_rider_archive_pagination_type', 'numeric' );
if ( 'disable' === $archive_pagination ) {
return;
}
if ( 'numeric' === $archive_pagination ) {
the_posts_pagination( array(
'prev_text' => blog_rider_get_icon_svg( 'menu_icon_up' ),
'next_text' => blog_rider_get_icon_svg( 'menu_icon_up' ),
) );
} elseif ( 'older_newer' === $archive_pagination ) {
the_posts_navigation( array(
'prev_text' => blog_rider_get_icon_svg( 'menu_icon_up' ) . ''. esc_html__( 'Older', 'blog-rider' ) .'',
'next_text' => ''. esc_html__( 'Newer', 'blog-rider' ) .'' . blog_rider_get_icon_svg( 'menu_icon_up' ),
) );
}
}
// Add auto p to the palces where get_the_excerpt is being called.
add_filter( 'get_the_excerpt', 'wpautop' );