classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; if ( in_array( 'current-menu-item', $classes, true ) || in_array( 'current-menu-parent', $classes, true ) ) { $classes[] = 'active'; } $args = apply_filters( 'nav_menu_item_args', $args, $item, $depth ); $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $item_id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth ); $item_id = $item_id ? ' id="' . esc_attr( $item_id ) . '"' : ''; $output .= $indent . ''; $atts = array( 'title' => ! empty( $item->attr_title ) ? $item->attr_title : '', 'target' => ! empty( $item->target ) ? $item->target : '', 'rel' => ! empty( $item->xfn ) ? $item->xfn : '', 'href' => ! empty( $item->url ) ? $item->url : '', ); $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $title = apply_filters( 'the_title', $item->title, $item->ID ); $link = $args->before; $link .= ''; $link .= $args->link_before . $title . $args->link_after; $link .= ''; $link .= $args->after; $output .= $link . "\n"; } } /** * Display custom logo with fallback to site name. * * @return void */ function peptide_starter_the_custom_logo() { if ( function_exists( 'the_custom_logo' ) ) { the_custom_logo(); } else { $site_name = get_bloginfo( 'name' ); echo ''; } } /** * Get hero title from Customizer. * * @return string Hero title text. */ function peptide_starter_get_hero_title() { return get_theme_mod( 'hero_title', get_bloginfo( 'name' ) ); } /** * Get hero subtitle from Customizer. * * @return string Hero subtitle text. */ function peptide_starter_get_hero_subtitle() { return get_theme_mod( 'hero_subtitle', esc_html__( 'A scientific peptide reference database', 'peptide-starter' ) ); } /** * Get search placeholder from Customizer. * * @return string Search placeholder text. */ function peptide_starter_get_search_placeholder() { return get_theme_mod( 'hero_search_placeholder', esc_html__( 'Search peptides, sequences, or research...', 'peptide-starter' ) ); } /** * Get footer copyright text from Customizer. * * @return string Copyright text (may contain safe HTML). */ function peptide_starter_get_footer_copyright() { return get_theme_mod( 'footer_copyright', esc_html__( 'Copyright © 2026 Peptide Repo. All rights reserved.', 'peptide-starter' ) ); } /** * Check if newsletter form should display. * * @return bool Whether to show the newsletter form. */ function peptide_starter_show_newsletter_form() { return apply_filters( 'peptide_starter_show_newsletter', true ); } /** * Render pagination links for archive pages. * * @return void */ function peptide_starter_pagination() { global $wp_query; if ( $wp_query->max_num_pages <= 1 ) { return; } $current = max( 1, get_query_var( 'paged' ) ); $total = $wp_query->max_num_pages; echo ''; } /** * Check if a specific plugin is active by its main file path. * * @param string $plugin Plugin file path relative to plugins directory. * @return bool Whether the plugin is active. */ function peptide_starter_is_plugin_active( $plugin ) { return in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ); }