/
No Comments', 'ayyash' ),
__( ' 1 Comment', 'ayyash' ),
__( ' % Comments', 'ayyash' )
);
}
endif;
if ( ! function_exists( 'themeoo_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @return void
*/
function themeoo_posted_on() {
$time_string = '%2$s ';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '%2$s %4$s ';
}
// @phpstan-ignore-next-line
$time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) );
?>
' . $time_string . '' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
);
?>
' . esc_html( get_the_author() ) . ' '
);
?>
'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( 'themeoo_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so themeoo_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so themeoo_categorized_blog should return false.
return false;
}
}
endif;
if ( ! function_exists( 'themeoo_post_taxonomy' ) ) :
/**
* Shim for `themeoo_post_taxonomy()`.
*
* Display category, tag, or term description.
*
* @param string $view view.
*
* @return void
*/
function themeoo_post_taxonomy( $view ) {
// Categories.
if ( themeoo_get_mod( 'layout_' . $view . '_meta-cats' ) ) :
echo get_the_category_list(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endif;
// Tags.
if ( themeoo_get_mod( 'layout_' . $view . '_meta-tags' ) ) :
// Replicates category output.
// @phpstan-ignore-next-line
echo get_the_tag_list( '' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
endif;
}
endif;
if ( ! function_exists( 'themeoo_post_single_navigation' ) ) :
/**
* Shim for `the_archive_description()`.
*
* Display category, tag, or term description.
*
* @return void
*/
function themeoo_post_single_navigation() {
?>
$depth,
'max_depth' => $args['max_depth'],
]
);
// Add icon.
$reply_link_args['reply_text'] = ' ' . __( 'Reply', 'ayyash' );
$reply_link_args['login_text'] = ' ' . __( 'Log in to Reply', 'ayyash' );
?>
str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), // @phpstan-ignore-line
'format' => '?paged=%#%',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'type' => 'array',
'prev_next' => true,
'prev_text' => ' ',
'next_text' => ' ',
) );
if ( is_array( $pages ) ) {
echo '';
echo '';
echo '
';
}
}
endif;
if ( ! function_exists( 'themeoo_breadcrumb' ) ) :
/**
* Prints breadcrumb HTML required by the theme
*
* @return void
*/
function themeoo_breadcrumb() {
global $post;
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
woocommerce_breadcrumb( array(
'wrap_before' => '',
'delimiter' => '',
'before' => '',
'after' => ' ',
) );
return;
}
// @phpstan-ignore-next-line
if ( function_exists( 'is_bbpress' ) && function_exists( 'bbp_breadcrumb' ) && is_bbpress() ) {
echo '';
// @phpstan-ignore-next-line
bbp_breadcrumb( array(
'delimiter' => '',
'before' => '',
'after' => ' ',
) );
echo ' ';
return;
}
// @TODO Add Yoast SEO (WP-SEO) Breadcrumbs Support.
echo '';
if ( ! is_front_page() ) {
echo '' . esc_html__( 'Home', 'ayyash' ) . ' ';
}
if ( ( ! is_tag() && is_tax() ) || is_category() || is_single() && ! is_singular( 'portfolio' ) ) {
if ( ( ! is_tag() && is_tax() ) || is_category() ) {
$category = [ get_queried_object() ];
} else {
$category = get_the_category();
}
if ( isset( $category[0] ) && is_a( $category[0], 'WP_Term' ) ) {
$categories = get_category_parents( $category[0]->term_id, true, '-|-' );
if ( ! is_wp_error( $categories ) ) {
// split into array of string.
$categories = explode( '-|-', $categories );
$categories = array_filter( $categories );
if ( ! empty( $categories ) ) {
echo '' . implode( ' ', $categories ) . ' '; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
}
if ( $post && is_singular( 'portfolio' ) ) {
// @phpstan-ignore-next-line
echo get_the_term_list( $post->ID, 'portfolio_category', '', ' - ', ' ' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( is_home() ) {
echo '' . esc_html( get_option( 'blog_title', __( 'Blog', 'ayyash' ) ) ) . ' ';
}
if ( is_single() || is_page() ) {
?> ' . esc_html__( '404 - Page not Found', 'ayyash' ) . '';
}
if ( is_search() ) {
echo '' . esc_html__( 'Search', 'ayyash' ) . ' ';
}
if ( is_year() ) {
echo '' . esc_html( get_the_date( _x( 'Y', 'yearly archives date format', 'ayyash' ) ) ) . ' '; // @phpstan-ignore-line
}
echo ' ';
}
endif;
if ( ! function_exists( 'themeoo_footer_social_icons' ) ) :
/**
* Prints Footer Social Icons HTML markup
*
* @return void
*/
function themeoo_footer_social_icons() {
if ( ! ( themeoo_get_mod( 'layout_footer_social' ) ) ) {
return;
}
themeoo_header_social_icons();
}
endif;
if ( ! function_exists( 'themeoo_header_social_icons' ) ) :
/**
* Prints Header Social Icons HTML markup
*
* @return void
*/
function themeoo_header_social_icons() {
$profiles = (array) themeoo_get_mod( 'social_profiles' );
$defaults = [
'label' => '',
'url' => '',
'icon' => '',
];
foreach ( $profiles as $profile ) {
$profile = wp_parse_args( $profile, $defaults );
if ( ! $profile['label'] || ! $profile['url'] || ! $profile['icon'] ) {
continue;
}
if ( false === strpos( $profile['icon'], 'ti-' ) ) {
$profile['icon'] = 'ti-' . $profile['icon'];
}
$attributes = '';
// don't open hash tag, tel or mailto in new tab.
if ( false !== strpos( $profile['url'], 'http', 0 ) ) {
$attributes .= ' target="_blank"';
}
printf(
' ',
esc_attr( $profile['label'] ),
esc_attr( $profile['icon'] ),
esc_url( $profile['url'] ),
esc_attr( $attributes )
);
}
}
endif;
if ( ! function_exists( 'themeoo_get_view' ) ) :
/**
* Determine the current view.
*
* @return string The string representing the current view.
*
* @return string
*/
function themeoo_get_view() {
// Post types.
$post_types = get_post_types(
[
'public' => true,
'_builtin' => false,
]
);
$post_types[] = 'post';
// Post parent.
$parent_post_type = '';
if ( is_attachment() ) {
$attachment = get_post();
$parent_post_type = $attachment ? get_post_type( $attachment->post_parent ) : '';
}
$view = 'post';
if ( is_home() ) {
$view = 'blog'; // Blog.
} elseif ( is_archive() && is_post_type_archive( 'product' ) != true ) {
$view = 'archive'; // Archives.
} elseif ( is_search() ) {
$view = 'search'; // Search results.
// @phpstan-ignore-next-line
} elseif ( is_singular( $post_types ) || ( is_attachment() && in_array( $parent_post_type, $post_types ) ) ) {
$view = 'post'; // Posts and public custom post types.
} elseif ( is_page() || ( is_attachment() && 'page' === $parent_post_type ) ) {
$view = 'page'; // Pages.
}
return $view;
}
endif;
if ( ! function_exists( 'themeoo_get_footer_copyright' ) ) :
/**
* Return Pxlrtheme footer copyright text.
*
* @return void
*/
function themeoo_get_footer_copyright() {
?>
ID );
$thumb_sizes = $thumb_id ? wp_get_attachment_metadata( $thumb_id, true ) : false;
if ( $thumb_sizes ) {
$width = $thumb_sizes['width'] >= 1140 ? 1140 : $thumb_sizes['width'];
$width = "style='width:{$width}px;max-width:100%'";
}
}
return $width;
}
endif;
if ( ! function_exists( 'themeoo_site_branding' ) ) :
/**
* Site Branding (Logo)
*
* @return void
*/
function themeoo_site_branding() {
?>
ID, 'themeoo_audio_source', true );
$source = get_post_meta( $post->ID, 'themeoo_audio_' . $type, true );
$mime = 'hosted' === $type ? get_post_mime_type( $source['id'] ) : false;
$content = get_the_content( null, false, $post );
if ( 'embedded' === $type && ! empty( $source ) ) {
?>
×
ID, 'themeoo_gallery', true );
$gallery = wp_parse_id_list( $gallery );
$slider_id = 'blog-gallery-slider' . $post->ID;
if ( ! empty( $gallery ) ) {
?>
ID, false );
if ( ! empty( $gallery ) && isset( $gallery['src'] ) && is_array( $gallery['src'] ) && ! empty( $gallery['src'] ) ) {
?>
ID ) && has_post_thumbnail( $post ) ) &&
has_block( 'core/image', $content )
) {
themeoo_print_first_instance_of_block( 'core/image', $content );
} else {
$image = get_media_embedded_in_content( apply_filters( 'the_content', $content ), array( 'image' ) );
if ( ! empty( $image ) ) {
echo wp_kses( $image[0], array(
'img' => array(
'width' => array(),
'height' => array(),
'src' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
),
) );
}
}
}
}
if ( ! function_exists( 'themeoo_post_format_get_post_link' ) ) {
/**
* Output Link for post-format-link
*
* @param WP_Post $post Current post.
* @param string $wrapper_classes Wrapper Classes.
*
* @return void
*/
function themeoo_post_format_get_post_link( $post = null, $wrapper_classes = '' ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
$link = get_post_meta( $post->ID, 'themeoo_link_url', true );
if ( ! empty( $link ) ) {
?>
ID, 'themeoo_quote_text', true );
$author = get_post_meta( $post->ID, 'themeoo_quote_author', true );
if ( ! empty( $quote ) ) {
?>
ID, 'themeoo_video_source', true );
$source = get_post_meta( $post->ID, 'themeoo_video_' . $type, true );
$duration = get_post_meta( $post->ID, 'themeoo_video_durations', true );
$mime = 'hosted' === $type && isset( $source['id'] ) ? get_post_mime_type( $source['id'] ) : false;
if ( 'embedded' === $type && ! empty( $source ) ) {
?>
×