BonuxDu13

Untitled

Jul 11th, 2021
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function montheme_supports () {
  4. add_theme_support('title-tag');
  5. add_theme_support('post-thumbnails');
  6. add_theme_support('menus');
  7. register_nav_menu('header', 'En tête du menu');
  8. register_nav_menu('footer', 'Pied de page');
  9. }
  10.  
  11. /*function register_my_menus() {
  12. register_nav_menus(array(
  13. 'header' => __( 'En tête du menu' ),
  14. 'footer' => __( 'Pied de page' ),
  15. )
  16. );
  17. }*/
  18.  
  19. function montheme_register_assets () {
  20. wp_register_style('bootstrap', 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css');
  21. wp_register_script('bootstrap', 'https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js', ['popper'], false, true);
  22. wp_register_script('popper', 'https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js', [], false, true);
  23. wp_enqueue_style('bootstrap');
  24. wp_enqueue_script('bootstrap');
  25. }
  26.  
  27. function montheme_title ($title) {
  28. return 'salut' .$title;
  29. }
  30.  
  31. function montheme_document_title_parts ($title) {
  32. unset($title['tagline']);
  33. return $title;
  34. }
  35.  
  36. function montheme_menu_class ($classes) {
  37. $classes[] = 'nav-item';
  38. return $classes;
  39. }
  40.  
  41. function montheme_menu_link_class ($atts) {
  42. $atts['class'] = 'nav-link';
  43. return $atts;
  44. }
  45.  
  46. add_action('after_setup_theme', 'montheme_supports');
  47. add_action('wp_enqueue_scripts', 'montheme_register_assets');
  48. add_filter('wp_title', 'montheme_title');
  49. add_filter('document_title_parts', 'montheme_document_title_parts');
  50. #add_action( 'init', 'register_my_menus' );
  51. add_filter('nav_menu_css_class', 'montheme_menu_class');
  52. add_filter('nav_menu_link_attributes', 'montheme_menu_link_class');
  53. ?>
RAW Paste Data