init commit
This commit is contained in:
43
template-parts/author/post-author-box.php
Normal file
43
template-parts/author/post-author-box.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Displays Author bio on single post
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
$author_id = get_the_author_meta( 'ID' );
|
||||
$author_avatar = get_avatar( $author_id, 'thumbnail' );
|
||||
$author_post_link = get_the_author_posts_link();
|
||||
$author_bio = get_the_author_meta( 'description' );
|
||||
$author_url = get_the_author_meta( 'user_url' );
|
||||
?>
|
||||
|
||||
<div class="mt-author-box">
|
||||
<?php if ( $author_avatar ) { ?>
|
||||
<div itemprop="image" class="mt-author__avatar">
|
||||
<?php echo wp_kses_post( $author_avatar ); ?>
|
||||
</div><!-- .mt-author-avatar -->
|
||||
<?php } ?>
|
||||
|
||||
<div class="mt-author-info">
|
||||
<?php if ( $author_post_link ) { ?>
|
||||
<h5 itemprop="name" class="mt-author-name"><?php echo wp_kses_post( $author_post_link ); ?></h5>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( $author_bio ) { ?>
|
||||
<div class="mt-author-bio">
|
||||
<?php echo wp_kses_post( $author_bio ); ?>
|
||||
</div><!-- .mt-author-bio -->
|
||||
<?php } ?>
|
||||
|
||||
<div class="mt-author-meta">
|
||||
<?php if ( $author_url ) { ?>
|
||||
<div class="mt-author-website">
|
||||
<span><?php esc_html_e( 'Website', 'sophia-after-dark' ); ?>:</span>
|
||||
<a href="<?php echo esc_url( $author_url ); ?>" target="_blank"><?php echo esc_url( $author_url ); ?></a>
|
||||
</div><!-- .mt-author-website -->
|
||||
<?php } ?>
|
||||
</div><!-- .mt-author-meta -->
|
||||
</div><!-- .mt-author-info -->
|
||||
</div><!-- .mt-author-bio -->
|
45
template-parts/content-none.php
Normal file
45
template-parts/content-none.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying a message that posts cannot be found
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
?>
|
||||
|
||||
<section class="no-results not-found">
|
||||
<header class="page-header">
|
||||
<h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'sophia-after-dark' ); ?></h1>
|
||||
</header><!-- .page-header -->
|
||||
|
||||
<div class="page-content">
|
||||
<?php
|
||||
if ( is_home() && current_user_can( 'publish_posts' ) ) :
|
||||
printf(
|
||||
'<p>' . wp_kses(
|
||||
/* translators: 1: link to WP admin new post page. */
|
||||
__( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'sophia-after-dark' ),
|
||||
array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
),
|
||||
)
|
||||
) . '</p>',
|
||||
esc_url( admin_url( 'post-new.php' ) )
|
||||
);
|
||||
elseif ( is_search() ) :
|
||||
?>
|
||||
<p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'sophia-after-dark' ); ?></p>
|
||||
<?php
|
||||
get_search_form();
|
||||
else :
|
||||
?>
|
||||
<p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'sophia-after-dark' ); ?></p>
|
||||
<?php
|
||||
get_search_form();
|
||||
endif;
|
||||
?>
|
||||
</div><!-- .page-content -->
|
||||
</section><!-- .no-results -->
|
45
template-parts/content-page.php
Normal file
45
template-parts/content-page.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying page content in page.php
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<?php sophia_after_dark_post_thumbnail(); ?>
|
||||
<div class="entry-content">
|
||||
<?php
|
||||
the_content();
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'sophia-after-dark' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<?php if ( get_edit_post_link() ) : ?>
|
||||
<footer class="entry-footer">
|
||||
<?php
|
||||
edit_post_link(
|
||||
sprintf(
|
||||
wp_kses(
|
||||
/* translators: %s: Name of current post. Only visible to screen readers */
|
||||
__( 'Edit <span class="screen-reader-text">%s</span>', 'sophia-after-dark' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
get_the_title()
|
||||
),
|
||||
'<span class="edit-link">',
|
||||
'</span>'
|
||||
);
|
||||
?>
|
||||
</footer><!-- .entry-footer -->
|
||||
<?php endif; ?>
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
62
template-parts/content-search.php
Normal file
62
template-parts/content-search.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying results in search pages
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
$post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' );
|
||||
if ( has_post_thumbnail() ) {
|
||||
$post_class = 'has-thumbnail wow fadeInUp';
|
||||
} else {
|
||||
$post_class = 'no-thumbnail wow fadeInUp';
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
|
||||
<?php
|
||||
echo '<div class="thumb-cat-wrap">';
|
||||
sophia_after_dark_post_thumbnail();
|
||||
sophia_after_dark_article_categories_list();
|
||||
echo '</div><!-- .thumb-cat-wrap -->';
|
||||
if ( 'post' === get_post_type() ) {
|
||||
?>
|
||||
<div class="entry-cat">
|
||||
<?php
|
||||
sophia_after_dark_posted_on();
|
||||
sophia_after_dark_posted_by();
|
||||
?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php } ?>
|
||||
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<?php
|
||||
if ( 'excerpt' === $post_content_type ) {
|
||||
the_excerpt();
|
||||
} elseif ( 'content' === $post_content_type ) {
|
||||
the_content( sprintf(
|
||||
wp_kses(
|
||||
/* translators: %s: Name of current post. Only visible to screen readers */
|
||||
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
get_the_title()
|
||||
) );
|
||||
}
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php sophia_after_dark_entry_footer(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
62
template-parts/content-single.php
Normal file
62
template-parts/content-single.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying single post
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( has_post_thumbnail() ) {
|
||||
$post_class = 'has-thumbnail';
|
||||
} else {
|
||||
$post_class = 'no-thumbnail';
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
|
||||
<div class="post-thumbnail">
|
||||
<?php
|
||||
if ( has_post_thumbnail() ) {
|
||||
the_post_thumbnail( 'full' );
|
||||
}
|
||||
?>
|
||||
<div class="post-info-wrap">
|
||||
<div class="post-cat"><?php sophia_after_dark_article_categories_list(); ?></div>
|
||||
<div class="entry-meta">
|
||||
<?php
|
||||
sophia_after_dark_posted_on();
|
||||
sophia_after_dark_posted_by();
|
||||
?>
|
||||
</div>
|
||||
<?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?>
|
||||
</div><!--.post-info-wrap -->
|
||||
</div><!-- .post-thumbnail -->
|
||||
|
||||
<div class="entry-content">
|
||||
<?php
|
||||
the_content( sprintf(
|
||||
wp_kses(
|
||||
/* translators: %s: Name of current post. Only visible to screen readers */
|
||||
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
get_the_title()
|
||||
) );
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'sophia-after-dark' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</div> <!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php sophia_after_dark_entry_footer(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
<?php get_template_part( 'template-parts/author/post', 'author-box' ); ?>
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
71
template-parts/content.php
Normal file
71
template-parts/content.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying posts
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
global $wp_query;
|
||||
$current_post = $wp_query->current_post;
|
||||
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' );
|
||||
$post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' );
|
||||
|
||||
if ( has_post_thumbnail() ) {
|
||||
$post_class = 'has-thumbnail';
|
||||
} else {
|
||||
$post_class = 'no-thumbnail';
|
||||
}
|
||||
if ( $current_post < 3 && 'mt-archive--masonry-style' === $archive_style ) {
|
||||
$post_class .= '';
|
||||
} else {
|
||||
$post_class .= ' wow fadeInUp';
|
||||
}
|
||||
?>
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
|
||||
<?php
|
||||
echo '<div class="thumb-cat-wrap">';
|
||||
sophia_after_dark_post_thumbnail();
|
||||
sophia_after_dark_article_categories_list();
|
||||
echo '</div><!-- .thumb-cat-wrap -->';
|
||||
if ( 'post' === get_post_type() ) {
|
||||
?>
|
||||
<div class="entry-cat">
|
||||
<?php
|
||||
sophia_after_dark_posted_on();
|
||||
sophia_after_dark_posted_by();
|
||||
?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php } ?>
|
||||
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<?php
|
||||
if ( 'excerpt' === $post_content_type ) {
|
||||
the_excerpt();
|
||||
} elseif ( 'content' === $post_content_type ) {
|
||||
the_content( sprintf(
|
||||
wp_kses(
|
||||
/* translators: %s: Name of current post. Only visible to screen readers */
|
||||
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
get_the_title()
|
||||
) );
|
||||
}
|
||||
?>
|
||||
</div><!-- .entry-content -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php sophia_after_dark_entry_footer(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
39
template-parts/related/content-related.php
Normal file
39
template-parts/related/content-related.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying related post
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( has_post_thumbnail() ) {
|
||||
$post_class = 'has-thumbnail wow fadeInUp';
|
||||
} else {
|
||||
$post_class = 'no-thumbnail wow fadeInUp';
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
|
||||
<?php
|
||||
echo '<div class="thumb-cat-wrap">';
|
||||
sophia_after_dark_post_thumbnail();
|
||||
sophia_after_dark_article_categories_list();
|
||||
echo '</div><!-- .thumb-cat-wrap -->';
|
||||
if ( 'post' === get_post_type() ) {
|
||||
?>
|
||||
<div class="entry-cat">
|
||||
<?php
|
||||
sophia_after_dark_posted_on();
|
||||
sophia_after_dark_posted_by();
|
||||
?>
|
||||
</div><!-- .entry-meta -->
|
||||
<?php } ?>
|
||||
|
||||
<header class="entry-header">
|
||||
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
|
||||
</header><!-- .entry-header -->
|
||||
|
||||
<footer class="entry-footer">
|
||||
<?php sophia_after_dark_entry_footer(); ?>
|
||||
</footer><!-- .entry-footer -->
|
||||
</article><!-- #post-<?php the_ID(); ?> -->
|
44
template-parts/related/related-posts.php
Normal file
44
template-parts/related/related-posts.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Shows related posts on single post page
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
global $post;
|
||||
$related_post_id = get_the_id();
|
||||
$get_categories = get_the_terms( $related_post_id, 'category' );
|
||||
$selected_cat = array();
|
||||
|
||||
// Get only category slug of current post.
|
||||
if ( $get_categories && is_array( $get_categories ) ) {
|
||||
foreach ( $get_categories as $category ) {
|
||||
$selected_cat[] = $category->term_id;
|
||||
}
|
||||
}
|
||||
$related_posts_count = apply_filters( 'sophia_after_dark_related_posts_count', 3 );
|
||||
$related_posts_title = apply_filters( 'sophia_after_dark_related_posts_section_title', __( 'Related Posts', 'sophia-after-dark' ) );
|
||||
|
||||
$related_posts_args = array(
|
||||
'posts_per_page' => absint( $related_posts_count ),
|
||||
'post__not_in' => array( $related_post_id ),
|
||||
'category__in' => $selected_cat,
|
||||
);
|
||||
$related_posts_query = new WP_Query( $related_posts_args );
|
||||
if ( $related_posts_query->have_posts() ) {
|
||||
?>
|
||||
<section class="mt-single-related-posts">
|
||||
<h2 class="mt-related-post-title"><?php echo esc_html( $related_posts_title ); ?></h2>
|
||||
|
||||
<div class="mt-related-posts-wrapper">
|
||||
<?php
|
||||
while ( $related_posts_query->have_posts() ) {
|
||||
$related_posts_query->the_post();
|
||||
get_template_part( 'template-parts/related/content', 'related' );
|
||||
}
|
||||
?>
|
||||
</div><!-- .mt-related-posts-wrapper -->
|
||||
</section><!-- .mt-single-related-posts -->
|
||||
<?php
|
||||
}
|
||||
wp_reset_postdata();
|
Reference in New Issue
Block a user