Initial commit: peptide-starter theme v1.3.1
This commit is contained in:
51
template-parts/content-none.php
Normal file
51
template-parts/content-none.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying content when nothing is found
|
||||
*
|
||||
* @package peptide-starter
|
||||
*/
|
||||
|
||||
?>
|
||||
<div class="ps-card">
|
||||
<header class="entry-header">
|
||||
<h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'peptide-starter' ); ?></h1>
|
||||
</header>
|
||||
|
||||
<div class="entry-content">
|
||||
<?php
|
||||
if ( is_search() ) {
|
||||
?>
|
||||
<p><?php esc_html_e( "Sorry, but nothing matched your search terms. Please try again with some different keywords.", 'peptide-starter' ); ?></p>
|
||||
<?php
|
||||
get_search_form();
|
||||
} elseif ( is_home() && current_user_can( 'publish_posts' ) ) {
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
wp_kses(
|
||||
__( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'peptide-starter' ),
|
||||
array(
|
||||
'a' => array(
|
||||
'href' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
esc_url( admin_url( 'post-new.php' ) )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
} elseif ( is_archive() ) {
|
||||
?>
|
||||
<p><?php esc_html_e( "It looks like there are no posts for this archive. Try a different category or date.", 'peptide-starter' ); ?></p>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p><?php esc_html_e( "It seems we can't find what you're looking for. Perhaps searching can help.", 'peptide-starter' ); ?></p>
|
||||
<?php
|
||||
get_search_form();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
48
template-parts/content-peptide.php
Normal file
48
template-parts/content-peptide.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying peptide cards in archive views
|
||||
*
|
||||
* @package peptide-starter
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'peptide-card' ); ?>>
|
||||
<header class="peptide-card__header">
|
||||
<h2 class="peptide-card__title">
|
||||
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
||||
</h2>
|
||||
<?php
|
||||
$categories = get_the_terms( get_the_ID(), 'peptide-category' );
|
||||
if ( $categories && ! is_wp_error( $categories ) ) {
|
||||
echo '<div class="peptide-card__meta">';
|
||||
foreach ( array_slice( $categories, 0, 2 ) as $cat ) {
|
||||
echo '<span class="peptide-card__badge">' . esc_html( $cat->name ) . '</span>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</header>
|
||||
|
||||
<div class="peptide-card__excerpt">
|
||||
<?php
|
||||
if ( has_excerpt() ) {
|
||||
echo wp_kses_post( wp_trim_words( get_the_excerpt(), 25, '…' ) );
|
||||
} else {
|
||||
echo wp_kses_post( wp_trim_words( get_the_content(), 25, '…' ) );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<footer class="peptide-card__footer">
|
||||
<a href="<?php the_permalink(); ?>" class="peptide-card__link">
|
||||
<?php esc_html_e( 'Learn More', 'peptide-starter' ); ?>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
||||
<path d="M3 8H13M13 8L9 4M13 8L9 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</a>
|
||||
</footer>
|
||||
</article>
|
||||
96
template-parts/content.php
Normal file
96
template-parts/content.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* Template part for displaying a single post/page
|
||||
*
|
||||
* @package peptide-starter
|
||||
*/
|
||||
|
||||
?>
|
||||
<article <?php post_class( 'ps-card' ); ?> id="post-<?php the_ID(); ?>">
|
||||
<header class="entry-header" style="margin-bottom: var(--spacing-lg);">
|
||||
<?php
|
||||
if ( is_singular() ) {
|
||||
the_title( '<h1 class="entry-title">', '</h1>' );
|
||||
} else {
|
||||
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
|
||||
}
|
||||
|
||||
if ( 'post' === get_post_type() ) {
|
||||
?>
|
||||
<div class="entry-meta" style="color: var(--color-text-secondary); font-size: var(--text-body-sm); margin-top: var(--spacing-sm);">
|
||||
<?php
|
||||
printf(
|
||||
esc_html__( 'Posted on %s', 'peptide-starter' ),
|
||||
'<time datetime="' . esc_attr( get_the_date( 'c' ) ) . '">' . esc_html( get_the_date() ) . '</time>'
|
||||
);
|
||||
echo ' ';
|
||||
printf(
|
||||
esc_html__( 'by %s', 'peptide-starter' ),
|
||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</header>
|
||||
|
||||
<div class="entry-content" style="margin-bottom: var(--spacing-lg);">
|
||||
<?php
|
||||
if ( has_post_thumbnail() ) {
|
||||
?>
|
||||
<div style="margin-bottom: var(--spacing-lg);">
|
||||
<?php the_post_thumbnail( 'medium' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
the_content(
|
||||
sprintf(
|
||||
wp_kses(
|
||||
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'peptide-starter' ),
|
||||
array(
|
||||
'span' => array(
|
||||
'class' => array(),
|
||||
),
|
||||
)
|
||||
),
|
||||
wp_kses_post( get_the_title() )
|
||||
)
|
||||
);
|
||||
|
||||
wp_link_pages(
|
||||
array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'peptide-starter' ),
|
||||
'after' => '</div>',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php if ( 'post' === get_post_type() ) { ?>
|
||||
<footer class="entry-footer" style="color: var(--color-text-secondary); font-size: var(--text-body-sm); border-top: 1px solid var(--color-border-default); padding-top: var(--spacing-md);">
|
||||
<?php
|
||||
$categories = get_the_category();
|
||||
if ( $categories ) {
|
||||
echo '<div style="margin-bottom: var(--spacing-sm);">';
|
||||
echo esc_html__( 'Categories: ', 'peptide-starter' );
|
||||
foreach ( $categories as $category ) {
|
||||
echo '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" class="ps-badge">' . esc_html( $category->name ) . '</a> ';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
$tags = get_the_tags();
|
||||
if ( $tags ) {
|
||||
echo '<div>';
|
||||
echo esc_html__( 'Tags: ', 'peptide-starter' );
|
||||
foreach ( $tags as $tag ) {
|
||||
echo '<a href="' . esc_url( get_tag_link( $tag->term_id ) ) . '" class="ps-badge">' . esc_html( $tag->name ) . '</a> ';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</footer>
|
||||
<?php } ?>
|
||||
</article>
|
||||
Reference in New Issue
Block a user