<?php
/*
Plugin Name: My breadcrumb  
Description: Fil d'Ariane pour les articles et les pages 
Version: 1.0 
License: GPLv2 

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

Copyright {année} {mon_nom} (email : {mon_email}) 
*/
function fil_ariane(){     
  global $post;       

  if (!is_front_page()) {     
    $fil = '<div id="fil">Vous êtes ici : ';  
    $fil.= '<a href="'.get_bloginfo('wpurl').'">';  
    $fil.= get_bloginfo('name');  
    $fil.= '</a> > ';
            
    $parents = array_reverse(get_ancestors($post->ID,'page')); 
      
      foreach($parents as $parent){   
        $fil.='<a href="'.get_permalink($parent).'">';   
        $fil.= get_the_title($parent);   
        $fil.= '</a> > ';   
      } 
          
    $fil.= $post->post_title;   
    
    $fil.= '</div>';   
  }             
return $fil;  
} 
function add_css(){     
    wp_register_style('my_breadcrumb', plugins_url('style.css', __FILE__));
    wp_enqueue_style('my_breadcrumb'); 
}
add_action( 'wp_enqueue_scripts', 'add_css' );
add_shortcode('mybreadcrumb','fil_ariane');
?>