Browse Source

fix: trim title in sidebar

Fixes #8
main
Kazhnuz Klappsthul 9 months ago
parent
commit
01cd47dd5e
  1. 2
      components/sidebar/last-articles.php
  2. 2
      footer.php
  3. 2
      header.php
  4. 11
      js/trim.js

2
components/sidebar/last-articles.php

@ -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',

2
footer.php

@ -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>

2
header.php

@ -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

@ -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))+'...');
}
});
});
Loading…
Cancel
Save