feat: add link page

This commit is contained in:
Kazhnuz 2022-12-18 19:19:04 +01:00
parent 0477ccbc1b
commit af058e2d8c
7 changed files with 85 additions and 2 deletions

View file

@ -7,8 +7,14 @@
foreach ($menu as $menuElement) {
echo '<li class="social-li"><a class="social-link" href="'. $menuElement->url .'" title="Accéder à mon '.$menuElement->title.'" aria-label="Accéder à mon '.$menuElement->title.'"><i class="fa fa-fw fa-'.$menuElement->title.'" aria-hidden="true"></i></a></li> ';
}
}
?>
<li class="social-li">
<a class="social-link" href="https://kazhnuz.space/links" title="Plus de liens" aria-label="Plus de liens">
<i class="fa fa-fw fa-ellipsis-h" aria-hidden="true"></i>
</a>
</li>
</ul>
<div class="footer-collumns">

View file

@ -2,7 +2,8 @@
</div>
<?php include(TEMPLATEPATH . '/components/footer-content.php'); ?>
<?php wp_footer(); ?>
<?php wp_footer(); ?>
<script src="<?php echo get_template_directory_uri();?>/js/trim.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/prettylinks.js"></script>
</body>
</html>

View file

@ -316,7 +316,8 @@ register_taxonomy('roman', 'post',
'top-navbar-2' => __( 'Navbar (droite)' ),
'link-menu' => __( 'Liste des liens' ),
'footer-pages' => __( 'Pages dans le footer' ),
'social' => __( 'Reseaux sociaux' )
'social' => __( 'Reseaux sociaux' ),
'social-plus' => __( 'Reseaux sociaux supplémentaires' ),
)
);
}

8
js/prettylinks.js Normal file
View file

@ -0,0 +1,8 @@
var length = 35;
$(function(){
$(".pretty-link").each(function(i){
var str = $(this).text().replace("https://", "");
$(this).text(str);
});
});

60
page-links.php Normal file
View file

@ -0,0 +1,60 @@
<?php /* Template Name: page-links */ ?>
<?php get_header(); ?> <!-- ouvrir header,php -->
<main>
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<article class="article-content" id="post-<?php the_ID(); ?>">
<h1 class="page-title"><?php the_title(); ?></h1>
<div class="article-body mb-2">
<?php the_content(); ?>
</div>
</article>
<div class="card card-primary">
<h2 class="card-header">Liste de mes réseaux sociaux</h2>
<table>
<thead>
<tr>
<th class="text-info">Réseau social</th>
<th class="text-right text-info">Lien</th>
</tr>
</thead>
<tbody>
<?php
$listmenu = get_nav_menu_locations();
$menu = wp_get_nav_menu_items($listmenu['social']);
if ($menu != null) {
foreach ($menu as $menuElement) {
?>
<tr>
<th><i class="fa fa-fw fa-<?php echo $menuElement->title; ?>" aria-hidden="true"></i> <span class="text-maj"><?php echo $menuElement->title; ?></span></th>
<td class="text-right"><a class="pretty-link" href="<?php echo $menuElement->url; ?>"><?php echo $menuElement->url; ?></td>
</tr>
<?php
}
}
?>
<?php
$listmenu = get_nav_menu_locations();
$menu = wp_get_nav_menu_items($listmenu['social-plus']);
if ($menu != null) {
foreach ($menu as $menuElement) {
?>
<tr>
<th><i class="fa fa-fw fa-<?php echo $menuElement->title; ?>" aria-hidden="true"></i> <span class="text-maj"><?php echo $menuElement->title; ?></span></th>
<td class="text-right"><a class="pretty-link" href="<?php echo $menuElement->url; ?>"><?php echo $menuElement->url; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php endwhile; ?>
<?php endif; ?>
</main>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View file

@ -325,3 +325,7 @@ th {
&-info { @include table-color($color-info); }
&-success { @include table-color($color-success); }
}
.text-maj {
text-transform: capitalize;
}

View file

@ -585,6 +585,9 @@ th {
.table-success th {
color: #859900; }
.text-maj {
text-transform: capitalize; }
/* --- 03. GLOBAL STYLING --- */
/*
* Les styles "globaux" touchant toute la page.