feat: ajout de menus customizables
This commit is contained in:
parent
473c4da58a
commit
735b203e66
4 changed files with 46 additions and 35 deletions
|
@ -1,11 +1,14 @@
|
||||||
<footer>
|
<footer>
|
||||||
<ul class="social">
|
<ul class="social">
|
||||||
<li class="social-li"><a class="social-link" href="https://twitter.com/kazhnuz" alt="Twitter"><i class="fa fa-fw fa-twitter"></i></a></li>
|
<?php
|
||||||
<li class="social-li"><a class="social-link" href="https://octodon.social/users/kazhnuz" alt="Mastodon"><i class="fa fa-fw fa-mastodon"></i></a></li>
|
$listmenu = get_nav_menu_locations();
|
||||||
<li class="social-li"><a class="social-link" href="https://framasphere.org/u/kazhnuz" alt="Diaspora"><i class="fa fa-fw fa-diaspora"></i></a></li>
|
$menu = wp_get_nav_menu_items($listmenu['social']);
|
||||||
<li class="social-li"><a class="social-link" href="https://deviantart.com/kazhnuz" alt="DeviantART"><i class="fa fa-fw fa-deviantart"></i></a></li>
|
if ($menu != null) {
|
||||||
<li class="social-li"><a class="social-link" href="https://github.com/kazhnuz" alt="Github"><i class="fa fa-fw fa-github"></i></a></li>
|
foreach ($menu as $menuElement) {
|
||||||
<li class="social-li"><a class="social-link" href="https://git.kobold.cafe/kazhnuz" alt="Gitlab"><i class="fa fa-fw fa-git"></i></a></li>
|
echo '<li class="social-li"><a class="social-link" href="'. $menuElement->url .'" alt="'.$menuElement->title.'"><i class="fa fa-fw fa-'.$menuElement->title.'"></i></a></li> ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="footer-collumns">
|
<div class="footer-collumns">
|
||||||
|
|
|
@ -1,29 +1,10 @@
|
||||||
<div class="navbar-area">
|
<div class="navbar-area">
|
||||||
<?php
|
<?php
|
||||||
$categories = get_categories( array(
|
$listmenu = get_nav_menu_locations();
|
||||||
'orderby' => 'name',
|
$menu = wp_get_nav_menu_items($listmenu['top-navbar']);
|
||||||
'order' => 'ASC'
|
foreach ($menu as $menuElement) {
|
||||||
) );
|
echo '<a href="' . $menuElement->url . '" class="btn btn-navbar">'. $menuElement->title . '</a>';
|
||||||
|
|
||||||
foreach( $categories as $category ) {
|
|
||||||
if ($category->slug == "blog") {
|
|
||||||
echo '<a class="btn btn-navbar" href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>';
|
|
||||||
}
|
}
|
||||||
}
|
?>
|
||||||
$pages = get_pages( array(
|
|
||||||
"sort_column" => 'menu_order',
|
|
||||||
'sort_order' => 'ASC'
|
|
||||||
));
|
|
||||||
if ( $pages ) {
|
|
||||||
foreach( $pages as $page ) {
|
|
||||||
if ($page->post_name != "home") {
|
|
||||||
echo '<a class="btn btn-navbar" href="'. get_page_link( $page->ID ) . '">'. $page->post_title .'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}?>
|
|
||||||
|
|
||||||
<!-- <a href="/blog.html" class="btn btn-navbar">Blog</a> -->
|
|
||||||
<!-- <a href="/crea.html" class="btn btn-navbar">Romans</a> -->
|
|
||||||
<!-- <a href="/apropos.html" class="btn btn-navbar">A propos</a> -->
|
|
||||||
<a href="<?php bloginfo('rss2_url'); ?>" class="btn btn-navbar"><i class="fa fa-rss"></i></a>
|
<a href="<?php bloginfo('rss2_url'); ?>" class="btn btn-navbar"><i class="fa fa-rss"></i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
|
<?php
|
||||||
|
$listmenu = get_nav_menu_locations();
|
||||||
|
$menu = wp_get_nav_menu_items($listmenu['link-menu']);
|
||||||
|
if ($menu != null) {
|
||||||
|
?>
|
||||||
<div class="card card-primary">
|
<div class="card card-primary">
|
||||||
<div class="card-header"><i class="fa fa-link"></i> Liens</div>
|
<div class="card-header"><i class="fa fa-link"></i> Liens</div>
|
||||||
<div class="card-menu">
|
<div class="card-menu">
|
||||||
<a href="https://kobold.city" class="menu-element">Kobold City</a>
|
<?php
|
||||||
<a href="https://rulebook.kobold.city" class="menu-element">Mes JDR</a>
|
$menu = wp_get_nav_menu_items( 'link-menu');
|
||||||
<a href="https://univers.kobold.city" class="menu-element">Mes Univers</a>
|
foreach ($menu as $menuElement) {
|
||||||
<a href="https://git.kobold.city" class="menu-element">Mon Gitea</a>
|
echo '<a href="' . $menuElement->url . '" class="menu-element">'. $menuElement->title . '</a>';
|
||||||
<a href="https://vault.kobold.city" class="menu-element">Vault</a>
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
|
@ -320,3 +320,21 @@ register_taxonomy('roman', 'post',
|
||||||
add_action( 'roman_add_form_fields', 'romans_taxonomy_custom_fields_add' );
|
add_action( 'roman_add_form_fields', 'romans_taxonomy_custom_fields_add' );
|
||||||
add_action( 'created_roman', 'save_taxonomy_custom_fields' );
|
add_action( 'created_roman', 'save_taxonomy_custom_fields' );
|
||||||
add_action( 'edited_roman', 'save_taxonomy_custom_fields', 10, 2 );
|
add_action( 'edited_roman', 'save_taxonomy_custom_fields', 10, 2 );
|
||||||
|
|
||||||
|
/* 4. Menus custom
|
||||||
|
*
|
||||||
|
* Quelques menus custom
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function wpb_custom_new_menu() {
|
||||||
|
register_nav_menus(
|
||||||
|
array(
|
||||||
|
'top-navbar' => __( 'Top Navbar' ),
|
||||||
|
'link-menu' => __( 'Links Menu' ),
|
||||||
|
'footer-pages' => __( 'Footer pages' ),
|
||||||
|
'social' => __( 'Reseaux sociaux' )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'init', 'wpb_custom_new_menu' );
|
||||||
|
|
Reference in a new issue