fix: resolve PHPCS coding standard violations for CI

- Convert all PHP files from CRLF to LF line endings
- Reformat multi-line function calls per WPCS standard
  (opening paren last on line, closing paren on own line)
- Fix assignment-in-conditional in single-peptide.php
- Change double quotes to single quotes in content-none.php
- Exclude InvalidClassFileName sniff (standard WP functions.php pattern)
- Fix archive-peptide.php opening PHP tag placement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-12 22:54:51 +07:00
parent 7226a08719
commit 65b9f7a13c
12 changed files with 1125 additions and 1033 deletions

View File

@@ -26,4 +26,9 @@
<rule ref="Generic.Arrays.DisallowShortArraySyntax"> <rule ref="Generic.Arrays.DisallowShortArraySyntax">
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/> <exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
</rule> </rule>
<!-- Standard WordPress practice: Walker class lives in functions.php -->
<rule ref="WordPress.Files.FileName">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
</rule>
</ruleset> </ruleset>

View File

@@ -70,4 +70,5 @@ get_header();
</div> </div>
</main> </main>
<?php get_footer(); <?php
get_footer();

View File

@@ -24,7 +24,9 @@ function peptide_starter_setup() {
add_theme_support( 'post-thumbnails' ); add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' ); add_theme_support( 'responsive-embeds' );
add_theme_support( 'custom-logo' ); add_theme_support( 'custom-logo' );
add_theme_support( 'html5', array( add_theme_support(
'html5',
array(
'search-form', 'search-form',
'comment-form', 'comment-form',
'comment-list', 'comment-list',
@@ -32,13 +34,16 @@ function peptide_starter_setup() {
'caption', 'caption',
'style', 'style',
'script', 'script',
) ); )
);
// Register navigation menus // Register navigation menus
register_nav_menus( array( register_nav_menus(
array(
'primary' => esc_html__( 'Primary Menu', 'peptide-starter' ), 'primary' => esc_html__( 'Primary Menu', 'peptide-starter' ),
'footer' => esc_html__( 'Footer Menu', 'peptide-starter' ), 'footer' => esc_html__( 'Footer Menu', 'peptide-starter' ),
) ); )
);
// Add support for wide blocks // Add support for wide blocks
add_theme_support( 'align-wide' ); add_theme_support( 'align-wide' );
@@ -60,10 +65,14 @@ function peptide_starter_scripts() {
wp_enqueue_script( 'peptide-starter-theme', PEPTIDE_STARTER_URI . '/assets/js/theme.js', array(), PEPTIDE_STARTER_VERSION, true ); wp_enqueue_script( 'peptide-starter-theme', PEPTIDE_STARTER_URI . '/assets/js/theme.js', array(), PEPTIDE_STARTER_VERSION, true );
// Pass PHP data to JavaScript // Pass PHP data to JavaScript
wp_localize_script( 'peptide-starter-theme', 'peptideStarterData', array( wp_localize_script(
'peptide-starter-theme',
'peptideStarterData',
array(
'siteUrl' => home_url( '/' ), 'siteUrl' => home_url( '/' ),
'isDarkMode' => get_theme_mod( 'dark_mode_default', false ), 'isDarkMode' => get_theme_mod( 'dark_mode_default', false ),
) ); )
);
// Dequeue comment reply script if comments are not open // Dequeue comment reply script if comments are not open
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
@@ -77,7 +86,9 @@ add_action( 'wp_enqueue_scripts', 'peptide_starter_scripts' );
* This ensures theme overrides (e.g. removing line-clamp on article excerpts) beat plugin CSS. * This ensures theme overrides (e.g. removing line-clamp on article excerpts) beat plugin CSS.
*/ */
function peptide_starter_plugin_overrides() { function peptide_starter_plugin_overrides() {
wp_add_inline_style( 'peptide-starter-style', ' wp_add_inline_style(
'peptide-starter-style',
'
/* Override Peptide News plugin line-clamp — show full summaries */ /* Override Peptide News plugin line-clamp — show full summaries */
p.pn-article-excerpt, p.pn-article-excerpt,
.pn-article-card p.pn-article-excerpt, .pn-article-card p.pn-article-excerpt,
@@ -87,7 +98,8 @@ function peptide_starter_plugin_overrides() {
display: block !important; display: block !important;
overflow: visible !important; overflow: visible !important;
} }
' ); '
);
} }
add_action( 'wp_enqueue_scripts', 'peptide_starter_plugin_overrides', 99 ); add_action( 'wp_enqueue_scripts', 'peptide_starter_plugin_overrides', 99 );
@@ -95,7 +107,8 @@ add_action( 'wp_enqueue_scripts', 'peptide_starter_plugin_overrides', 99 );
* Register widget areas * Register widget areas
*/ */
function peptide_starter_widgets_init() { function peptide_starter_widgets_init() {
register_sidebar( array( register_sidebar(
array(
'name' => esc_html__( 'Footer - Column 1', 'peptide-starter' ), 'name' => esc_html__( 'Footer - Column 1', 'peptide-starter' ),
'id' => 'footer-1', 'id' => 'footer-1',
'description' => esc_html__( 'Footer widget area 1', 'peptide-starter' ), 'description' => esc_html__( 'Footer widget area 1', 'peptide-starter' ),
@@ -103,9 +116,11 @@ function peptide_starter_widgets_init() {
'after_widget' => '</div>', 'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>', 'after_title' => '</h3>',
) ); )
);
register_sidebar( array( register_sidebar(
array(
'name' => esc_html__( 'Footer - Column 2', 'peptide-starter' ), 'name' => esc_html__( 'Footer - Column 2', 'peptide-starter' ),
'id' => 'footer-2', 'id' => 'footer-2',
'description' => esc_html__( 'Footer widget area 2', 'peptide-starter' ), 'description' => esc_html__( 'Footer widget area 2', 'peptide-starter' ),
@@ -113,9 +128,11 @@ function peptide_starter_widgets_init() {
'after_widget' => '</div>', 'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>', 'after_title' => '</h3>',
) ); )
);
register_sidebar( array( register_sidebar(
array(
'name' => esc_html__( 'Footer - Column 3', 'peptide-starter' ), 'name' => esc_html__( 'Footer - Column 3', 'peptide-starter' ),
'id' => 'footer-3', 'id' => 'footer-3',
'description' => esc_html__( 'Footer widget area 3', 'peptide-starter' ), 'description' => esc_html__( 'Footer widget area 3', 'peptide-starter' ),
@@ -123,9 +140,11 @@ function peptide_starter_widgets_init() {
'after_widget' => '</div>', 'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>', 'after_title' => '</h3>',
) ); )
);
register_sidebar( array( register_sidebar(
array(
'name' => esc_html__( 'Footer - Column 4', 'peptide-starter' ), 'name' => esc_html__( 'Footer - Column 4', 'peptide-starter' ),
'id' => 'footer-4', 'id' => 'footer-4',
'description' => esc_html__( 'Footer widget area 4', 'peptide-starter' ), 'description' => esc_html__( 'Footer widget area 4', 'peptide-starter' ),
@@ -133,7 +152,8 @@ function peptide_starter_widgets_init() {
'after_widget' => '</div>', 'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">', 'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>', 'after_title' => '</h3>',
) ); )
);
} }
add_action( 'widgets_init', 'peptide_starter_widgets_init' ); add_action( 'widgets_init', 'peptide_starter_widgets_init' );
@@ -142,93 +162,135 @@ add_action( 'widgets_init', 'peptide_starter_widgets_init' );
*/ */
function peptide_starter_customize_register( $wp_customize ) { function peptide_starter_customize_register( $wp_customize ) {
// Logo section // Logo section
$wp_customize->add_section( 'peptide_starter_branding', array( $wp_customize->add_section(
'peptide_starter_branding',
array(
'title' => esc_html__( 'Branding', 'peptide-starter' ), 'title' => esc_html__( 'Branding', 'peptide-starter' ),
'priority' => 30, 'priority' => 30,
) ); )
);
// Hero settings section // Hero settings section
$wp_customize->add_section( 'peptide_starter_hero', array( $wp_customize->add_section(
'peptide_starter_hero',
array(
'title' => esc_html__( 'Hero Section', 'peptide-starter' ), 'title' => esc_html__( 'Hero Section', 'peptide-starter' ),
'priority' => 40, 'priority' => 40,
) ); )
);
// Hero Title // Hero Title
$wp_customize->add_setting( 'hero_title', array( $wp_customize->add_setting(
'hero_title',
array(
'default' => get_bloginfo( 'name' ), 'default' => get_bloginfo( 'name' ),
'transport' => 'postMessage', 'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
) ); )
);
$wp_customize->add_control( 'hero_title', array( $wp_customize->add_control(
'hero_title',
array(
'label' => esc_html__( 'Hero Title', 'peptide-starter' ), 'label' => esc_html__( 'Hero Title', 'peptide-starter' ),
'section' => 'peptide_starter_hero', 'section' => 'peptide_starter_hero',
'type' => 'text', 'type' => 'text',
) ); )
);
// Hero Subtitle // Hero Subtitle
$wp_customize->add_setting( 'hero_subtitle', array( $wp_customize->add_setting(
'hero_subtitle',
array(
'default' => esc_html__( 'A scientific peptide reference database', 'peptide-starter' ), 'default' => esc_html__( 'A scientific peptide reference database', 'peptide-starter' ),
'transport' => 'postMessage', 'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
) ); )
);
$wp_customize->add_control( 'hero_subtitle', array( $wp_customize->add_control(
'hero_subtitle',
array(
'label' => esc_html__( 'Hero Subtitle', 'peptide-starter' ), 'label' => esc_html__( 'Hero Subtitle', 'peptide-starter' ),
'section' => 'peptide_starter_hero', 'section' => 'peptide_starter_hero',
'type' => 'textarea', 'type' => 'textarea',
) ); )
);
// Hero Search Placeholder // Hero Search Placeholder
$wp_customize->add_setting( 'hero_search_placeholder', array( $wp_customize->add_setting(
'hero_search_placeholder',
array(
'default' => esc_html__( 'Search peptides, sequences, or research...', 'peptide-starter' ), 'default' => esc_html__( 'Search peptides, sequences, or research...', 'peptide-starter' ),
'transport' => 'postMessage', 'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
) ); )
);
$wp_customize->add_control( 'hero_search_placeholder', array( $wp_customize->add_control(
'hero_search_placeholder',
array(
'label' => esc_html__( 'Search Placeholder', 'peptide-starter' ), 'label' => esc_html__( 'Search Placeholder', 'peptide-starter' ),
'section' => 'peptide_starter_hero', 'section' => 'peptide_starter_hero',
'type' => 'text', 'type' => 'text',
) ); )
);
// Footer section // Footer section
$wp_customize->add_section( 'peptide_starter_footer', array( $wp_customize->add_section(
'peptide_starter_footer',
array(
'title' => esc_html__( 'Footer', 'peptide-starter' ), 'title' => esc_html__( 'Footer', 'peptide-starter' ),
'priority' => 50, 'priority' => 50,
) ); )
);
// Footer Copyright Text — allows safe HTML (links, bold, em) via wp_kses_post // Footer Copyright Text — allows safe HTML (links, bold, em) via wp_kses_post
$wp_customize->add_setting( 'footer_copyright', array( $wp_customize->add_setting(
'footer_copyright',
array(
'default' => esc_html__( 'Copyright © 2026 Peptide Repo. All rights reserved.', 'peptide-starter' ), 'default' => esc_html__( 'Copyright © 2026 Peptide Repo. All rights reserved.', 'peptide-starter' ),
'transport' => 'postMessage', 'transport' => 'postMessage',
'sanitize_callback' => 'wp_kses_post', 'sanitize_callback' => 'wp_kses_post',
) ); )
);
$wp_customize->add_control( 'footer_copyright', array( $wp_customize->add_control(
'footer_copyright',
array(
'label' => esc_html__( 'Copyright Text', 'peptide-starter' ), 'label' => esc_html__( 'Copyright Text', 'peptide-starter' ),
'section' => 'peptide_starter_footer', 'section' => 'peptide_starter_footer',
'type' => 'textarea', 'type' => 'textarea',
) ); )
);
// Dark mode section // Dark mode section
$wp_customize->add_section( 'peptide_starter_theme_mode', array( $wp_customize->add_section(
'peptide_starter_theme_mode',
array(
'title' => esc_html__( 'Theme Mode', 'peptide-starter' ), 'title' => esc_html__( 'Theme Mode', 'peptide-starter' ),
'priority' => 60, 'priority' => 60,
) ); )
);
// Dark mode default // Dark mode default
$wp_customize->add_setting( 'dark_mode_default', array( $wp_customize->add_setting(
'dark_mode_default',
array(
'default' => false, 'default' => false,
'transport' => 'refresh', 'transport' => 'refresh',
'sanitize_callback' => 'peptide_starter_sanitize_checkbox', 'sanitize_callback' => 'peptide_starter_sanitize_checkbox',
) ); )
);
$wp_customize->add_control( 'dark_mode_default', array( $wp_customize->add_control(
'dark_mode_default',
array(
'label' => esc_html__( 'Enable Dark Mode by Default', 'peptide-starter' ), 'label' => esc_html__( 'Enable Dark Mode by Default', 'peptide-starter' ),
'section' => 'peptide_starter_theme_mode', 'section' => 'peptide_starter_theme_mode',
'type' => 'checkbox', 'type' => 'checkbox',
) ); )
);
} }
add_action( 'customize_register', 'peptide_starter_customize_register' ); add_action( 'customize_register', 'peptide_starter_customize_register' );
@@ -382,7 +444,8 @@ function peptide_starter_pagination() {
$total_pages = $wp_query->max_num_pages; $total_pages = $wp_query->max_num_pages;
echo '<nav class="ps-pagination">'; echo '<nav class="ps-pagination">';
echo paginate_links( array( echo paginate_links(
array(
'base' => get_pagenum_link( 1 ) . '%_%', 'base' => get_pagenum_link( 1 ) . '%_%',
'format' => 'page/%#%/', 'format' => 'page/%#%/',
'current' => $current_page, 'current' => $current_page,
@@ -390,7 +453,8 @@ function peptide_starter_pagination() {
'prev_text' => esc_html__( '← Previous', 'peptide-starter' ), 'prev_text' => esc_html__( '← Previous', 'peptide-starter' ),
'next_text' => esc_html__( 'Next →', 'peptide-starter' ), 'next_text' => esc_html__( 'Next →', 'peptide-starter' ),
'type' => 'plain', 'type' => 'plain',
) ); )
);
echo '</nav>'; echo '</nav>';
} }

View File

@@ -29,14 +29,16 @@
<!-- Primary Navigation --> <!-- Primary Navigation -->
<nav class="primary-navigation"> <nav class="primary-navigation">
<?php <?php
wp_nav_menu( array( wp_nav_menu(
array(
'theme_location' => 'primary', 'theme_location' => 'primary',
'fallback_cb' => 'peptide_starter_primary_menu_fallback', 'fallback_cb' => 'peptide_starter_primary_menu_fallback',
'walker' => new Peptide_Starter_Nav_Walker(), 'walker' => new Peptide_Starter_Nav_Walker(),
'depth' => 2, 'depth' => 2,
'container' => false, 'container' => false,
'items_wrap' => '<ul>%3$s</ul>', 'items_wrap' => '<ul>%3$s</ul>',
) ); )
);
?> ?>
</nav> </nav>

View File

@@ -39,25 +39,45 @@ get_header();
<!-- Meta Information --> <!-- Meta Information -->
<div class="peptide-meta" style="margin-top: var(--spacing-3xl); padding-top: var(--spacing-2xl); border-top: 1px solid var(--color-border-default);"> <div class="peptide-meta" style="margin-top: var(--spacing-3xl); padding-top: var(--spacing-2xl); border-top: 1px solid var(--color-border-default);">
<dl> <dl>
<?php if ( $formula = get_post_meta( get_the_ID(), 'peptide_formula', true ) ) { ?> <?php
$formula = get_post_meta( get_the_ID(), 'peptide_formula', true );
if ( $formula ) {
?>
<dt><strong><?php esc_html_e( 'Molecular Formula:', 'peptide-starter' ); ?></strong></dt> <dt><strong><?php esc_html_e( 'Molecular Formula:', 'peptide-starter' ); ?></strong></dt>
<dd><code><?php echo esc_html( $formula ); ?></code></dd> <dd><code><?php echo esc_html( $formula ); ?></code></dd>
<?php } ?> <?php
}
?>
<?php if ( $sequence = get_post_meta( get_the_ID(), 'peptide_sequence', true ) ) { ?> <?php
$sequence = get_post_meta( get_the_ID(), 'peptide_sequence', true );
if ( $sequence ) {
?>
<dt><strong><?php esc_html_e( 'Sequence:', 'peptide-starter' ); ?></strong></dt> <dt><strong><?php esc_html_e( 'Sequence:', 'peptide-starter' ); ?></strong></dt>
<dd><code><?php echo esc_html( $sequence ); ?></code></dd> <dd><code><?php echo esc_html( $sequence ); ?></code></dd>
<?php } ?> <?php
}
?>
<?php if ( $molecular_weight = get_post_meta( get_the_ID(), 'peptide_molecular_weight', true ) ) { ?> <?php
$molecular_weight = get_post_meta( get_the_ID(), 'peptide_molecular_weight', true );
if ( $molecular_weight ) {
?>
<dt><strong><?php esc_html_e( 'Molecular Weight:', 'peptide-starter' ); ?></strong></dt> <dt><strong><?php esc_html_e( 'Molecular Weight:', 'peptide-starter' ); ?></strong></dt>
<dd><?php echo esc_html( $molecular_weight ); ?> Da</dd> <dd><?php echo esc_html( $molecular_weight ); ?> Da</dd>
<?php } ?> <?php
}
?>
<?php if ( $therapeutic_use = get_post_meta( get_the_ID(), 'peptide_therapeutic_use', true ) ) { ?> <?php
$therapeutic_use = get_post_meta( get_the_ID(), 'peptide_therapeutic_use', true );
if ( $therapeutic_use ) {
?>
<dt><strong><?php esc_html_e( 'Therapeutic Use:', 'peptide-starter' ); ?></strong></dt> <dt><strong><?php esc_html_e( 'Therapeutic Use:', 'peptide-starter' ); ?></strong></dt>
<dd><?php echo esc_html( $therapeutic_use ); ?></dd> <dd><?php echo esc_html( $therapeutic_use ); ?></dd>
<?php } ?> <?php
}
?>
</dl> </dl>
</div> </div>

View File

@@ -15,7 +15,7 @@
<?php <?php
if ( is_search() ) { 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> <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'peptide-starter' ); ?></p>
<?php <?php
get_search_form(); get_search_form();
} elseif ( is_home() && current_user_can( 'publish_posts' ) ) { } elseif ( is_home() && current_user_can( 'publish_posts' ) ) {
@@ -38,11 +38,11 @@
<?php <?php
} elseif ( is_archive() ) { } 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> <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 <?php
} else { } else {
?> ?>
<p><?php esc_html_e( "It seems we can't find what you're looking for. Perhaps searching can help.", 'peptide-starter' ); ?></p> <p><?php esc_html_e( 'It seems we can\'t find what you\'re looking for. Perhaps searching can help.', 'peptide-starter' ); ?></p>
<?php <?php
get_search_form(); get_search_form();
} }