Markup categories menu


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. # Помечаем первый и последний пункт в меню Wordpress ( use wp_list_categories() )
  4.  
  5. function add_markup_categories($output) {
  6. $output= preg_replace('/cat-item/', ' first-cat-item cat-item', $output, 1);
  7. $output=substr_replace($output, " last-cat-item cat-item", strripos($output, "cat-item"), strlen("cat-item"));
  8. return $output;
  9. }
  10. add_filter('wp_list_categories', 'add_markup_categories');
  11. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.