post_title, $post );
}
} else {
$title = get_the_title();
}
echo "<" . tag_escape( $atts['tag'] ) . ">" . $title . "" . tag_escape( $atts['tag'] ) . ">";
}
function althea_wp_site_title() {
$site_title = get_bloginfo( 'name' );
echo esc_html( $site_title );
}
function althea_wp_post_title( $atts ) {
$atts = array_merge(
array(
'heading_type' => 'h3',
'classes' => 'althea-wp-word-wrap'
),
$atts
);
$title_tempalte = '<%2$s class="%4$s">%3$s%2$s>';
printf( $title_tempalte,
esc_url( get_the_permalink() ),
tag_escape( $atts['heading_type'] ),
get_the_title(),
esc_attr( $atts['classes'] )
);
}
function althea_wp_post_excerpt( $attrs = array() ) {
echo '
' . get_the_excerpt() . '
';
}
function althea_wp_post_thumb_placeholder_classes( $atts = array() ) {
$result = 'colibri-post-thumbnail-has-placeholder';
$show_placeholder = get_theme_mod( 'blog_show_post_thumb_placeholder',
Defaults::get( 'blog_show_post_thumb_placeholder', true )
);
if ( intval( $show_placeholder ) ) {
echo $result;
}
}
function althea_wp_post_thumbnail_classes( $atts = array() ) {
$result = 'colibri-post-has-no-thumbnail';
if ( has_post_thumbnail() ) {
$result = 'colibri-post-has-thumbnail';
}
if ( get_theme_mod( 'blog_show_post_thumb_placeholder',
Defaults::get( 'blog_show_post_thumb_placeholder', true ) ) ) {
$result .= ' colibri-post-thumbnail-has-placeholder';
}
echo $result;
}
function althea_wp_post_thumbnail( $atts = array() ) {
$show_placeholder = get_theme_mod( 'blog_show_post_thumb_placeholder',
Defaults::get( 'blog_show_post_thumb_placeholder', true ) );
if ( ! has_post_thumbnail() && ! $show_placeholder ) {
return;
}
if ( has_post_thumbnail() ) {
if ( Utils::pathGet( $atts, 'link', false ) ) {
?>
'',
),
$attrs
);
$html = "";
if ( $atts['prefix'] !== '' ) {
$html .= '' . althea_wp_esc_html_preserve_spaces( $atts['prefix'] ) . '';
}
if ( $categories ) {
foreach ( $categories as $category ) {
$html .= sprintf( '%2$s',
esc_url( get_category_link( $category->term_id ) ),
esc_html( $category->name )
);
}
} else {
$html .= sprintf( '%s', esc_html__( 'No Category', 'althea-wp' ) );
}
echo $html;
}
function althea_wp_esc_html_preserve_spaces( $text ) {
return esc_html( str_replace( " ", " ", $text ) );
}
function althea_wp_post_tags( $attrs = array() ) {
$atts = shortcode_atts(
array(
'prefix' => '',
),
$attrs
);
$tags = get_the_tags( get_the_ID() );
$html = '';
if ( $atts['prefix'] !== '' ) {
$html .= '' . althea_wp_esc_html_preserve_spaces( $atts['prefix'] ) . '';
}
if ( $tags ) {
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$tag_title = sprintf( __( 'Tag: %s', 'althea-wp' ), $tag->name );
$html .= sprintf( '%s',
esc_url( $tag_link ),
esc_attr( $tag_title ),
esc_html( $tag->name )
);
}
} else {
$html .= sprintf( '%s', esc_html__( 'No Tag', 'althea-wp' ) );
}
echo $html;
}
function althea_wp_get_nav_direction_wp_name( $type ) {
return $type == "next" ? $type : "previous";
}
function althea_wp_print_navigation_button( $type, $button_text ) {
$args = array(
'prev_text' => '%title',
'next_text' => '%title',
'in_same_term' => false,
'excluded_terms' => '',
'taxonomy' => 'category',
'screen_reader_text' => __( 'Post navigation', 'althea-wp' ),
);
$navigation = '';
$direction_wp_name = althea_wp_get_nav_direction_wp_name( $type );
$outer = "%link
";
$nav_link_fct = "get_{$direction_wp_name}_post_link";
$navigation = call_user_func( $nav_link_fct,
$outer,
$button_text,
$args['in_same_term'],
$args['excluded_terms'],
$args['taxonomy']
);
// Only add markup if there's somewhere to navigate to.
if ( $navigation ) {
$navigation = _navigation_markup( $navigation, 'post-navigation',
$args['screen_reader_text'] );
}
echo $navigation;
}
function althea_wp_post_nav_button( $atts = array() ) {
$type = $atts['type'];
$meta = $atts["{$type}_post"];
$button_text = '' . $meta . ' ' .
'%title';
althea_wp_print_navigation_button( $type, $button_text );
}
function althea_wp_button_pagination( $args, $atts ) {
$type = $atts['type'];
$nav_direction = althea_wp_get_nav_direction_wp_name( $type );
$label = $atts["{$type}_label"];
$link = call_user_func( "get_{$nav_direction}_posts_link", '' . $label . '' );
?>
' .
' ' . $args["screen_reader_text"] . '
' .
' ' .
'
' . $links . '
' .
'
' .
'';
echo $template;
}
function althea_wp_render_pagination( $pagination_type, $atts = array(), $args = array() ) {
$args = wp_parse_args( $args, array(
'before_page_number' => ''
. __( 'Page', 'althea-wp' )
. ' ',
'prev_text' => '',
'next_text' => '',
'prev_next' => false,
'screen_reader_text' => __( 'Posts navigation',
'althea-wp' ),
) );
call_user_func( $pagination_type, $args, $atts );
}
function althea_wp_archive_nav_button( $attrs = array() ) {
$atts = shortcode_atts(
array(
'type' => 'next',
'next_label' => '',
'prev_label' => ''
),
$attrs
);
althea_wp_render_pagination( 'althea_wp_button_pagination', $atts );
}
function althea_wp_archive_pagination() {
althea_wp_render_pagination( '\althea_wp_numbers_pagination' );
}
function althea_wp_render_page_comments() {
if ( ! comments_open() ) {
return;
}
?>
__( 'No responses yet', 'althea-wp' ),
'one' => __( 'One response', 'althea-wp' ),
'multiple' => __( 'Responses', 'althea-wp' ),
'avatar_size' => 32
),
$attrs
);
ob_start();
add_filter( 'comments_template', 'althea_wp_post_comments_template' );
if ( comments_open( get_the_ID() ) ) {
comments_template();
} else {
return "";
}
$content = ob_get_clean();
remove_filter( 'comments_template', 'althea_wp_post_comments_template' );
echo $content;
}
function althea_wp_post_comment_form() {
}
function althea_wp_widget_area( $atts ) {
if ( is_customize_preview() ) {
global $wp_customize;
$wp_customize->widgets->selective_refresh_init();
}
$atts = shortcode_atts(
array(
'id' => 'widget-1',
),
$atts
);
$id = "colibri-" . $atts['id'];
$id = Hooks::prefixed_apply_filters( 'widget_area_id', $id );
ob_start();
dynamic_sidebar( $id );
$content = ob_get_clean();
echo $content;
}
function althea_wp_post_meta_time_url() {
return '';
}
function althea_wp_has_multiple_pages() {
global $wp_query;
$adjacent_post = get_next_post();
if ( empty( $adjacent_post ) ) {
$adjacent_post = get_previous_post();
}
if ( is_single() ) {
return ! empty( $adjacent_post );
}
return ( $wp_query->max_num_pages > 1 );
}
function althea_wp_output_sidebar_search_form( $form = '' ) {
ob_start();
get_template_part( 'template-parts/blog/searchform' );
return ob_get_clean();
}
function althea_wp_post_comments_template( $form = '' ) {
return 'template-parts/blog/comments.php';
}
function althea_wp_theme_print_footer_copyright() {
?>
© .
.
© .
"",
"slug" => ""
),
$atts
);
$name = $atts['name'];
?>