diff options
| author | tradam <[email protected]> | 2025-11-18 23:37:40 +0000 |
|---|---|---|
| committer | tradam <[email protected]> | 2025-11-18 23:37:40 +0000 |
| commit | 072f012398e448682f6d1cb0d981bdbb5e46263c (patch) | |
| tree | 388689a338820c60ad93ff0c61fcaba258773943 | |
| parent | 5ec6e44935e7c979fd718d6aa2c7a5308da0ee54 (diff) | |
| download | malcz-wordpress-theme-dev.tar.gz malcz-wordpress-theme-dev.zip | |
progressdev
| -rwxr-xr-x | archive.php | 7 | ||||
| -rwxr-xr-x | css/header.css | 83 | ||||
| -rwxr-xr-x | footer.php | 8 | ||||
| -rwxr-xr-x | functions.php | 6 | ||||
| -rwxr-xr-x | header.php | 13 | ||||
| -rw-r--r-- | includes/section-archive.php | 12 | ||||
| -rwxr-xr-x | js/parallax-header.js | 1 | ||||
| -rw-r--r-- | plugins/class-wp-picocss-navwalker.php | 57 | ||||
| -rwxr-xr-x | single.php | 7 |
9 files changed, 179 insertions, 15 deletions
diff --git a/archive.php b/archive.php index e69de29..3d35e4d 100755 --- a/archive.php +++ b/archive.php @@ -0,0 +1,7 @@ +<?php get_header();?> + + <main class="container"> + <?php get_template_part('includes/section', 'archive'); ?> + </main> + +<?php get_footer();?>
\ No newline at end of file diff --git a/css/header.css b/css/header.css index 0e7ba08..67a9548 100755 --- a/css/header.css +++ b/css/header.css @@ -1,7 +1,8 @@ :root { - --heading-height: 15em; + --heading-height: 13.25em; } header { + pointer-events: none; position: fixed; width: 100%; height: var(--heading-height); @@ -26,12 +27,13 @@ header { } header::before { + pointer-events: all; content: ""; display: block; position: absolute; left: 0; bottom: 6em; - width: 100%; + width: 1024px; height: calc(var(--heading-height) + 10em); z-index: -1; transform: skewY(-3.5deg); @@ -42,6 +44,13 @@ header::before { border-bottom: var(--header-border-thickness) solid var(--header-border-color); } + +@media only screen and (min-width: 1024px) { + header::before { + width: 100%; + } +} + h1 { font-size: calc(0.8em + 2.6vw); font-weight: 700; @@ -55,11 +64,49 @@ body { } body > main { - padding: var(--heading-height) 4em 0; + padding: calc(var(--heading-height) - 2em) 4em 0; } -.site-title { +/* +.site-title a { margin: 0; + color: var(--pico-secondary); + transition-duration: 0.25s; +} + +.site-title a:hover { + color: var(--pico-contrast-hover); +} + +.site-title a span { + color: var(--pico-contrast-hover); +} + +.site-title a[aria-current="page"] { + color: var(--pico-secondary-hover); + font-weight: bold; +} + +.site-title a[aria-current="page"]:hover { + color: var(--pico-contrast-hover); +} + +.site-title a[aria-current="page"] span { + color: var(--pico-primary-hover); +} + */ + +.site-title a { + color: var(--pico-secondary-hover); + font-weight: bold; +} + +.site-title a { + color: var(--pico-contrast-hover); +} + +.site-title a span { + color: var(--pico-primary-hover); } .nav-list { @@ -82,6 +129,7 @@ body > main { } .header-inner { + pointer-events: all; display: flex; justify-content: space-between; align-items: top; @@ -95,7 +143,11 @@ body > main { } .main-nav { - margin-top: 0.5rem; + margin-top: -0.5rem; +} + +.main-nav ul li a { + text-decoration: none; } .dropdown-menu { @@ -122,8 +174,23 @@ nav.theme-selector { margin-top: 1em; } -@media (max-width: var(--breakpoint-sm)) { - .theme-selector { - margin-top: 0.5em; +@media (max-width: 500px) { + nav.theme-selector { + position: fixed; + top: 2px; + right: 2px; } } + +.pico-delinkify { + text-decoration: none; +} + +footer { + display: flex; + justify-content: center; +} + +footer p { + display: inline-block; +}
\ No newline at end of file @@ -1,4 +1,6 @@ - -<?php wp_footer();?> -</body> + <footer> + <p>Send me a message! <a href="mailto:adam@malcz.com">adam@malcz.com</a></p> + </footer> + <?php wp_footer();?> + </body> </html> diff --git a/functions.php b/functions.php index 4358df1..f48605d 100755 --- a/functions.php +++ b/functions.php @@ -53,7 +53,7 @@ register_nav_menus( array( 'top-menu' => 'Top Menu Location', - 'mobile-menu' => 'Mobile Menu Location' + //'mobile-menu' => 'Mobile Menu Location' ) ); @@ -73,3 +73,7 @@ add_filter('nav_menu_link_attributes', function($atts, $item, $args, $depth) { return $atts; }, 10, 4); +function register_navwalker() { + require_once get_template_directory() . '/plugins/class-wp-picocss-navwalker.php'; +} +add_action('after_setup_theme', 'register_navwalker'); @@ -22,8 +22,14 @@ <header class="site-header"> <div class="header-inner container"> <div class="header-main"> - <h1 class="site-title">Adam Malczewski</h1> - <div data-theme="dark"> + <h1 class="site-title" data-theme="dark"> + <a href="<?php echo home_url(); ?>" + class="pico-delinkify" + <?php if ( is_front_page() ) : ?>aria-current="page"<?php endif; ?>> + Adam <span<?php if ( is_front_page() ) echo ' aria-current="page"'; ?>>Malcz</span>ewski + </a> + </h1> + <div> <?php wp_nav_menu( array( @@ -32,7 +38,8 @@ 'container_class' => 'main-nav', 'container_aria_label' => 'Main menu', 'menu_class' => 'nav-list', - 'fallback_cb' => false + 'fallback_cb' => false, + 'walker' => new Pico_Details_Nav_Walker(), ) ); ?> diff --git a/includes/section-archive.php b/includes/section-archive.php new file mode 100644 index 0000000..c41a57d --- /dev/null +++ b/includes/section-archive.php @@ -0,0 +1,12 @@ +<?php if(have_posts()): while(have_posts()): the_post(); ?> + <a href="<?php the_permalink();?>" class="pico-delinkify secondary"> + <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> + <h3 class="entry-title"><?php the_title(); ?></h3> + <div class="entry-content"> + <?php the_excerpt(); ?> + </div> + </article> + </a> +<?php endwhile; else: ?> + <p><?php esc_html_e('Sorry, no posts matched your criteria.'); ?></p> +<?php endif; ?>
\ No newline at end of file diff --git a/js/parallax-header.js b/js/parallax-header.js index c4ce1fc..52990f8 100755 --- a/js/parallax-header.js +++ b/js/parallax-header.js @@ -13,6 +13,7 @@ document.addEventListener("scroll", () => { function animate() { currentPercent += (targetPercent - currentPercent) * tweenSpeed; + currentPercent = Math.max(Math.min(targetMax, currentPercent), targetMin); document.documentElement.style.setProperty('--scroll-percent', currentPercent + '%'); requestAnimationFrame(animate); } diff --git a/plugins/class-wp-picocss-navwalker.php b/plugins/class-wp-picocss-navwalker.php new file mode 100644 index 0000000..1cf617d --- /dev/null +++ b/plugins/class-wp-picocss-navwalker.php @@ -0,0 +1,57 @@ +<?php +class Pico_Details_Nav_Walker extends Walker_Nav_Menu { + + // Only called for submenus + public function start_lvl( &$output, $depth = 0, $args = array() ) { + $indent = str_repeat("\t", $depth); + $output .= "\n$indent<ul class=\"dropdown-menu\">\n"; + } + + public function end_lvl( &$output, $depth = 0, $args = array() ) { + $indent = str_repeat("\t", $depth); + $output .= "$indent</ul>\n"; + } + + public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { + $has_children = in_array('menu-item-has-children', $item->classes); + + // Top-level item with children -> use <details> + if ($depth === 0 && $has_children) { + $output .= '<details class="dropdown">'; + $output .= '<summary role="button" class="outline contrast" data-theme="dark">' . esc_html($item->title) . '</summary>'; + } + // Top-level item WITHOUT children -> <li> with data-theme="dark" + elseif ($depth === 0 && !$has_children) { + $atts = []; + $atts['href'] = !empty($item->url) ? esc_url($item->url) : '#'; + $attributes = ''; + foreach ($atts as $attr => $value) { + $attributes .= " $attr=\"$value\""; + } + + $output .= '<li data-theme="dark"><a' . $attributes . ' class="contrast">' . esc_html($item->title) . '</a>'; + } + // Submenu items -> normal <li> without data-theme + else { + $atts = []; + $atts['href'] = !empty($item->url) ? esc_url($item->url) : '#'; + $attributes = ''; + foreach ($atts as $attr => $value) { + $attributes .= " $attr=\"$value\""; + } + + $output .= '<li><a' . $attributes . ' class="contrast">' . esc_html($item->title) . '</a>'; + } + } + + + public function end_el( &$output, $item, $depth = 0, $args = array() ) { + $has_children = in_array('menu-item-has-children', $item->classes); + + if ($depth === 0 && $has_children) { + $output .= '</details>'; + } else { + $output .= '</li>'; + } + } +} @@ -0,0 +1,7 @@ +<?php get_header();?> + + <main class="container"> + <?php get_template_part('includes/section', 'content'); ?> + </main> + +<?php get_footer();?>
\ No newline at end of file |
