' . esc_html( get_the_author() ) . ' | '
);
echo ' ' . $byline . ''; // WPCS: XSS OK.
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo ' | ';
}
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ', ', 'armada' ) );
if ( $categories_list ) {
printf( '' . esc_html__( 'in %1$s', 'armada' ) . '', $categories_list ); // WPCS: XSS OK.
}
}
endif;
if ( ! function_exists( 'armada_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function armada_posted_by() {
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'armada' ),
'' . esc_html( get_the_author() ) . ' '
);
echo ' ' . $byline . ''; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'armada_categorized_blog' ) ) :
/**
* Returns true if a blog has more than 1 category.
*
* @return bool
*/
function armada_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'theme_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories( array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
) );
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'theme_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so theme_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so theme_categorized_blog should return false.
return false;
}
//return true;
}
endif;
if ( ! function_exists( 'armada_category_transient_flusher' ) ) :
/**
* Flush out the transients used in armada_categorized_blog.
*/
function armada_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'armada_categories' );
}
endif;
add_action( 'edit_category', 'armada_category_transient_flusher' );
add_action( 'save_post', 'armada_category_transient_flusher' );
if ( ! function_exists( 'armada_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function armada_entry_footer() {
edit_post_link( esc_html__( 'Edit', 'armada' ), '', '' );
// Hide category and tag text for pages.
if ( 'post' == get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', ', ' );
if ( $tags_list ) {
printf( '' . esc_html__( 'Tagged %1$s', 'armada' ) . '', $tags_list ); // WPCS: XSS OK.
}
}
}
endif;
if ( ! function_exists( 'armada_posted_on_classic' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*/
function armada_posted_on_classic() {
$byline = sprintf(
esc_html_x( 'by %s', 'post author', 'armada' ),
'' . esc_html( get_the_author() ) . ' '
);
echo ' ' . $byline . ''; // WPCS: XSS OK.
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo ' ';
}
}
endif;
if ( ! function_exists( 'armada_comment_form' ) ) :
/**
* Prints modify comment form.
*/
function armada_comment_form() {
// Modify comment form field
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email_url_comment' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'author' => '',
'email' =>
'',
'url' =>
'',
);
$args = array(
'fields' => apply_filters( 'comment_form_default_fields', $fields ),
'comment_field' => '',
);
comment_form($args);
}
endif;
if ( ! function_exists( 'armada_comment_count' ) ) :
/**
* Get comment number.
*/
function armada_comment_count() {
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
}
endif;
if ( ! function_exists( 'armada_src' ) ) :
/**
* Get post thumbnail attachment scr
*/
function armada_src( $post ) {
if (has_post_thumbnail( $post ) ) {
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post ), 'full' );
return $src[0];
}
}
endif;
if ( ! function_exists( 'armada_breadcrumb' ) ) :
/**
* Return post breadcrumb.
*/
function armada_breadcrumb( $post ) {
if ( !is_home() ) {
echo 'Home';
echo ' / ';
if ( is_category() || is_single() ) {
the_category(' / ');
$post_type = get_post_type_object( get_post_type( $post ) );
if ( $post_type->label != 'Posts' ) {
echo strip_tags( $post_type->label );
}
if ( is_single() ) {
echo ' / '; strip_tags( the_title() );
}
} elseif ( is_page() ) {
$ancestors = get_post_ancestors( $post );
$ancestor_html = array();
foreach ( $ancestors as $ancestor ) {
$ancestor_html[] = get_the_title( $ancestor );
}
echo implode( ' / ', $ancestor_html );
echo strip_tags( the_title() );
}
} elseif ( is_tag() ) {
strip_tags( single_tag_title() );
} elseif ( is_day() ) {
echo esc_html__( 'Archive for ', 'armada' ); the_time( 'F jS, Y' );
} elseif ( is_month() ) {
echo esc_html__( 'Archive for ', 'armada' ); the_time( 'F, Y' );
} elseif ( is_year() ) {
echo esc_html__( 'Archive for ', 'armada' ); the_time( 'Y' );
} elseif ( is_author() ) {
echo esc_html__( 'Author Archive', 'armada' );
} elseif ( isset( $_GET['paged'] ) && !empty( $_GET['paged'] ) ) {
echo esc_html__( 'Blog Archives', 'armada' );
} elseif ( is_search() ) {
echo esc_html__( 'Search Results', 'armada' );
} else {
echo esc_html__( 'Home', 'armada' );
echo " / ";
}
}
endif;
if ( ! function_exists( 'armada_excerpt' ) ) :
/**
* Return excerpt with html tag cleanup.
*/
function armada_excerpt( $limit ) {
$excerpt = explode( ' ', get_the_excerpt(), $limit );
if ( count( $excerpt ) >= $limit ) {
array_pop( $excerpt );
$excerpt = implode( ' ', $excerpt ) . ' ...';
} else {
$excerpt = implode( ' ', $excerpt );
}
$excerpt = preg_replace( '`\[[^\]]*\]`' , '', $excerpt );
return $excerpt;
}
endif;
if ( ! function_exists( 'armada_content' ) ) :
/**
* Return content with html tag cleanup.
*/
function armada_content( $limit ) {
$content = explode( ' ', get_the_content(), $limit );
if ( count( $content ) >= $limit ) {
array_pop( $content );
$content = implode( ' ', $content ) . ' ...';
} else {
$content = implode( ' ', $content );
}
$content = preg_replace( '/\[.+\]/','', $content );
$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]>', $content );
return $content;
}
endif;
// uneven 5 function
function armada_uneven_5( $num, $picture, $animation ) {
$ani = '';
if ( $animation != '' ) { $ani = 'fx-start'; }
$result;
if ( $num == 1) {
$result = '';
} elseif ( $num == 2) {
$result = '';
} elseif ( $num == 3) {
$result = '';
} elseif ( $num == 4) {
$result = '';
} elseif ( $num == 5) {
$result = '';
}
return $result;
}
// uneven 9 function
function armada_uneven_9( $num, $picture, $animation ) {
$ani = '';
if ( $animation != '' ) { $ani = 'fx-start'; }
$result;
if ( $num == 1) {
$result = '';
} elseif ( $num == 2) {
$result = '';
} elseif ( $num == 3) {
$result = '';
} elseif ( $num == 4) {
$result = '';
} elseif ( $num == 5) {
$result = '';
} elseif ( $num == 6) {
$result = '';
} elseif ( $num == 7) {
$result = '';
} elseif ( $num == 8) {
$result = '';
} elseif ( $num == 9) {
$result = '';
}
return $result;
}
// Escape KSES
function armada_allowed_kses( $html ) {
$allow = array_merge( wp_kses_allowed_html( 'post' ), array(
'h1' => array(),
'h2' => array(),
'h3' => array(),
'h4' => array(),
'h5' => array(),
'h6' => array(),
'p' => array(),
'ul' => array(),
'li' => array(),
'span' => array(),
'strong' => array(),
'small' => array(
'id' => true,
'class' => true,
'style' => true,
),
'i' => array(
'class' => true,
),
'button' => array(
'id' => true,
'class' => true,
'style' => true,
),
'section' => array(
'id' => true,
'class' => true,
'style' => true,
),
'div' => array(
'id' => true,
'class' => true,
'style' => true,
),
'img' => array(
'src' => true,
'width' => true,
'height' => true,
'data-original' => true,
'alt' => true,
'id' => true,
'class' => true,
'style' => true,
),
'a' => array(
'target' => true,
'href' => true,
'alt' => true,
'id' => true,
'class' => true,
'style' => true,
),
));
return wp_kses( $html, $allow );
}