fix: trim title in sidebar

Fixes #8
This commit is contained in:
Kazhnuz 2021-01-02 19:49:49 +01:00
parent 74100e99bf
commit 01cd47dd5e
4 changed files with 15 additions and 2 deletions

View file

@ -1,6 +1,6 @@
<div class="card card-primary">
<div class="card-header"><i class="fa fa-rss"></i> Publications</div>
<div class="card-menu">
<div class="card-menu trim-that">
<?php
wp_get_archives( array(
'type' => 'postbypost',

View file

@ -3,6 +3,6 @@
<?php include(TEMPLATEPATH . '/components/footer-content.php'); ?>
<?php wp_footer(); ?>
<script src="<?php echo get_template_directory_uri();?>/dep/jquery/js/jquery.min.js"></script>
<script src="<?php echo get_template_directory_uri();?>/js/trim.js"></script>
</body>
</html>

View file

@ -24,6 +24,8 @@
<!-- CSS -->
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet"/>
<script src="<?php echo get_template_directory_uri();?>/dep/jquery/jquery.js"></script>
</head>
<!-- Début du vrai HTML -->

11
js/trim.js Normal file
View file

@ -0,0 +1,11 @@
var length = 35;
$(function(){
$(".trim-that a, limit").each(function(i){
len=$(this).text().length;
if(len>length)
{
$(this).text($(this).text().substr(0,(length-3))+'...');
}
});
});