in center top menu added dropdown and tag cloud

This commit is contained in:
jorge 2021-05-27 00:48:48 +02:00
parent 96a29595d6
commit cbd58fb809
10 changed files with 143 additions and 52 deletions

View File

@ -26,6 +26,13 @@ get_header(); ?>
<?php echo category_description(); ?>
</div>
<?php endif; ?>
<?php if (is_category('peephole')) : ?>
<div class="bfr_category_tags">
<?php // wp_tag_cloud( 'unit=rem&smallest=1&largest=1&number=0&orderby=name' ); ?>
</div>
<?php endif; ?>
<div class="bfr_category_archive">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>

View File

@ -27,6 +27,7 @@ require_once( 'library/class-foundationpress-comments.php' );
require_once( 'library/navigation.php' );
/** Add menu walkers for top-bar and off-canvas */
require_once( 'library/class-foundationpress-center-top-bar-walker.php' );
require_once( 'library/class-foundationpress-top-bar-walker.php' );
require_once( 'library/class-foundationpress-mobile-walker.php' );

View File

@ -1,50 +0,0 @@
<?php
/**
* The template for displaying the header
*
* Displays all of the head element and everything up until the "container" div.
*
* @package Biofriction
* @since Biofriction 1.0.0
*/
?>
<!doctype html>
<html class="no-js" <?php language_attributes(); ?> >
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php if ( get_theme_mod( 'wpt_mobile_menu_layout' ) === 'offcanvas' ) : ?>
<?php get_template_part( 'template-parts/mobile-off-canvas' ); ?>
<?php endif; ?>
<header class="site-header" role="banner">
<div class="site-title-bar title-bar" <?php foundationpress_title_bar_responsive_toggle(); ?>>
<div class="title-bar-left">
<button aria-label="<?php _e( 'Main Menu', 'foundationpress' ); ?>" class="menu-icon" type="button" data-toggle="<?php foundationpress_mobile_menu_id(); ?>"></button>
<span class="site-mobile-title title-bar-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</span>
</div>
</div>
<nav class="site-navigation top-bar" role="navigation" id="<?php foundationpress_mobile_menu_id(); ?>">
<div class="top-bar-left">
<div class="site-desktop-title top-bar-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
</div>
</div>
<div class="top-bar-right">
<?php foundationpress_top_bar_r(); ?>
<?php if ( ! get_theme_mod( 'wpt_mobile_menu_layout' ) || get_theme_mod( 'wpt_mobile_menu_layout' ) === 'topbar' ) : ?>
<?php get_template_part( 'template-parts/mobile-top-bar' ); ?>
<?php endif; ?>
</div>
</nav>
</header>

View File

@ -25,7 +25,16 @@
<div class="site-custom-logo biofriction-logo-moving-transp cell small-12 medium-3 shrink"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php //the_custom_logo(); ?></a></div>
<div class="site-name"><h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1></div>
<div class="site-description"><h2><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'description' ); ?></a></h2></div>
<nav class="site-top-widgets"><?php dynamic_sidebar( 'header-widgets' ); ?></nav>
<!--nav class="site-top-widgets"--><?php //dynamic_sidebar( 'header-widgets' ); ?><!--/nav-->
<nav class="site-center-top-nav medium-6 grid-x align-center">
<?php foundationpress_top_bar_c(); ?>
<aside class="bfr_category_tags">
<?php if (is_category('peephole') || is_tag() ) : ?>
<?php wp_tag_cloud( 'unit=rem&smallest=1&largest=1&number=0&orderby=name' ); ?>
<?php endif; ?>
</aside>
</nav>
<nav class="site-top-nav menu"><?php foundationpress_top_bar_r(); ?></nav>
</content>
</header>

View File

@ -0,0 +1,20 @@
<?php
/**
* Customize the output of menus for Foundation top bar
*
* @package Biofriction
* @since Biofriction 1.0.0
*/
/**
* Big thanks to Brett Mason (https://github.com/brettsmason) for the awesome walker
*/
if ( ! class_exists( 'Foundationpress_Center_Top_Bar_Walker' ) ) :
class Foundationpress_Center_Top_Bar_Walker extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul id=\"menu-center-top\" class=\"dropdown menu vertical\" data-toggle>\n";
}
}
endif;

View File

@ -9,11 +9,32 @@
register_nav_menus(
array(
'top-bar-c' => esc_html__( 'Center Top Bar', 'foundationpress' ),
'top-bar-r' => esc_html__( 'Right Top Bar', 'foundationpress' ),
'mobile-nav' => esc_html__( 'Mobile', 'foundationpress' ),
)
);
/**
* Desktop navigation - center top bar
*
* @link http://codex.wordpress.org/Function_Reference/wp_nav_menu
*/
if ( ! function_exists( 'foundationpress_top_bar_c' ) ) {
function foundationpress_top_bar_c() {
wp_nav_menu(
array(
'container' => false,
'menu_class' => 'center dropdown menu menu desktop-menu',
'items_wrap' => '<ul id="%1$s" class="%2$s" data-dropdown-menu>%3$s</ul>',
'theme_location' => 'top-bar-c',
'depth' => 3,
'fallback_cb' => false,
'walker' => new Foundationpress_Center_Top_Bar_Walker(),
)
);
}
}
/**
* Desktop navigation - right top bar

View File

@ -84,6 +84,7 @@
@import "components/formstype";
@import "components/gallery";
@import "components/links";
@import "components/tags";
@import "components/wpcf7"; // contact form 7 overrides
// Templates

View File

@ -0,0 +1,15 @@
.bfr_category_tags {
.tag-cloud-link::before {
content: '#';
display: inline-block;
}
a{
padding:0;
margin:0 0.5rem;
&:hover {
color:$primary-color;
background-color:$secondary-color;
}
}
}

View File

@ -17,6 +17,18 @@
height: 10rem;
background-image: url('../images/biofriction-logo-moving-trans-loosy-100.gif');
}
.bfr_category_tags {
min-height: $global-margin * 6.5;
margin-bottom: -($global-margin * 6.5);
padding-top: $global-padding;
display:flex;
justify-content:center;
a {
display:inline-block;
margin-bottom: auto;
}
}
}
}
}

View File

@ -15,6 +15,51 @@
}
// Site top-navigation
.site-center-top-nav{
font-family: $header-font-family;
.menu-item {
&:hover {
background-color: scale-color($secondary-color, $lightness: +20%)
}
border-radius: $button-radius;
}
.dropdown.menu > {
li {
margin: 0 $global-margin/2;
border-width: $global-padding/6;
border-style: solid;
border-color: $primary-color;
&.current-menu-item {
background: $primary-color;
a {
color: $secondary-color;
}
&:hover {
background: $secondary-color;
a {
color:$primary-color;
}
}
}
a {
padding: $global-padding*0.7 $global-padding*1 ;
color:$primary-color;
}
}
li.current-menu-item.is-active > a {
// color:$secondary-color;
}
li.is-dropdown-submenu-parent > a::after {
border-color: $primary-color transparent transparent;
}
}
.submenu {
background:none;
li {
background-color: $body-background;
}
}
}
.site-top-widgets{
font-family: $header-font-family;
.menu-item {
@ -31,7 +76,11 @@
&:hover {
background: $secondary-color;
}
// &.is-active,
&.is-active {
a {
color:$secondary-color;
}
}
&.current-menu-item {
border-color: $primary-color;
background: $primary-color;
@ -48,6 +97,12 @@
}
}
}
.submenu {
background:none;
li {
background-color: $body-background;
}
}
}
.site-top-nav{
font-family: $header-font-family;