ID) ? $post->ID : -1; if (is_home || is_single || !is_page) { $content = dom_swipebox($content, $id); //$content = dom_swipebox_2($content, $id); } } return $content; } /* automatically insert rel="lightbox[nameofpost]" to every image with no manual work. if there are already rel="lightbox[something]" attributes, they are not clobbered. Michael Tyson, you are a regular expressions god! - http://atastypixel.com function jqlb_do_regexp($content, $id){ $id = esc_attr($id); $pattern = "/(]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)(\?\S{0,}){0,1}['\"][^\>]*)>/i"; $replacement = '$1 rel="lightbox['.$id.']">'; return preg_replace($pattern, $replacement, $content); } */ /*** ***/ function dom_swipebox_2($content, $id) { $id = esc_attr($id); // Nom du script JS de lightbox $lightbox = 'swipebox'; $content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8"); $html = new DOMDocument(); $html->loadHTML($content); $root = $html->documentElement; // get the first child node (the root) $elms = $root->getElementsByTagName("*"); // gets all elements ("*") in root $nr_elms = $elms->length; // gets the number of elements // loop through all elements stored in $elms for($i = 0; $i<$nr_elms; $i++) { $node = $elms->item($i); // gets the current node // on recherche les liens if($node->nodeName=='a') { $old_node = $node; // on teste si le lien n'appartient pas à une gallery $parent = $node->parentNode; if ($parent->nodeName != 'dt') { $enfants = $node->childNodes; foreach($enfants as $enfant) { //uniquement les liens images //et pas les liens textex bla-bla if ($enfant->nodeName == 'img') { //On récupère l'attribut 'class' et on ajoute swipebox à sa valeur $oldClass = $node->getAttribute('class'); if (strstr($oldClass, $lightbox) != false) $newClass = $oldClass; else $newClass = $oldClass . ' ' . $lightbox; $node->setAttribute('class', $newClass); //Chaque article à sa gallery $newRel = 'gallery-' . $id; $node->setAttribute('rel', $newRel); // } } } /* else { echo $old_node->nodeValue; } */ } } // save the new xml content in the same file and output its structure $newHtml = preg_replace('/^/', '', str_replace( array('', '', '', ''), array('', '', '', ''), $html->saveHTML())); return $newHtml; } /*** ***/ function dom_swipebox($content, $id) { $id = esc_attr($id); // Nom du script JS de lightbox $lightbox = 'swipebox'; $content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8"); $html = new DOMDocument(); libxml_use_internal_errors(true); if (strlen($content) > 1) $html->loadHTML($content); // Autre solution: if (strlen($content) > 1) @$html->loadHTML($content); // contact else return $content; // liens //print_r($html); // On récupère tous les nodes 'liens' $links = $html->getElementsByTagName('a'); foreach ($links as $link) { $parents = $link->parentNode; foreach($parents as $parent) { echo $parent->nodeName; } $enfants = $link->childNodes; foreach($enfants as $enfant) { // On se s'occupe uniquement que liens image if ($enfant->nodeName == 'img') { //On récupère l'attribut 'class' et on ajoute swipebox à sa valeur $oldClass = $link->getAttribute('class'); if (strstr($oldClass, $lightbox) != false) $newClass = $oldClass; else $newClass = $oldClass . ' ' . $lightbox; $link->setAttribute('class', $newClass); //Chaque article à sa gallery $newRel = 'gallery-' . $id; $link->setAttribute('rel', $newRel); // } } } $newHtml = preg_replace('/^/', '', str_replace( array('', '', '', ''), array('', '', '', ''), $html->saveHTML())); return $newHtml; } /** Enleve les width et height attributes**/ //add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); //add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); //function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; } /** /Enleve les width et height attributes**/ /*** Ajout d'un bouton ZP dans l'éditeur visuel (tinymce) ***/ add_action('init','add_buttons'); function add_buttons(){ if(current_user_can('edit_posts') && current_user_can('edit_pages')){ add_filter('mce_external_plugins','add_plugins'); add_filter('mce_buttons','register_buttons'); } } function add_plugins($plugins){ $plugins['zp'] = get_bloginfo('stylesheet_directory').'/js/zenphoto.js'; return $plugins; } function register_buttons($buttons){ array_push($buttons, 'zp'); return $buttons; } /*** /ajout bouton ZP dans l'editeur ***/ add_theme_support( 'post-thumbnails' ); add_image_size( 'similar-thumbnail', 120, 80, true ); function my_theme_setup() { // adding a new image size add_image_size( 'slider-thumbnail', 1200, '', true ); //add_image_size( 'similar-thumbnail', 120, 80, true ); } /*** Register footer widgets ***/ register_sidebar( array( 'name' => __( 'Footer Widget One', 'tto' ), 'id' => 'sidebar-4', 'description' => __( 'Found at the bottom of every page (except 404s, optional homepage and full width) as the footer. Left Side.', 'tto' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Two', 'tto' ), 'id' => 'sidebar-5', 'description' => __( 'Found at the bottom of every page (except 404s, optional homepage and full width) as the footer. Center.', 'tto' ), 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Widget Three', 'tto' ), 'id' => 'sidebar-6', 'description' => __( 'Found at the bottom of every page (except 404s, optional homepage and full width) as the footer. Right Side.', 'tto' ), 'before_widget' => '", 'before_title' => '

', 'after_title' => '

', ) ); /*** /Register footer widgets ***/ /*** Supprime les fontes Google ***/ function twtwFFWD_queuing() { wp_dequeue_style( 'twentytwelve-fonts' ); } add_action('wp_enqueue_scripts', 'twtwFFWD_queuing', 11 ); /*** Page d'options (administration) ***/ // à l'initialisation de l'administration // on informe WordPress des options de notre thème add_action( 'admin_init', 'myThemeRegisterSettings' ); function myThemeRegisterSettings( ) { register_setting( 'twentytwelve-child', 'zenphoto_url' ); // url de zenphoto register_setting( 'twentytwelve-child', 'img_size' ); // taille des images register_setting( 'twentytwelve-child', 'display_comment' ); // afficher les comentaires register_setting( 'twentytwelve-child', 'description' ); // description auteur register_setting( 'twentytwelve-child', 'similar' ); // articles similaires register_setting( 'twentytwelve-child', 'add_lightbox' ); // ajoute la class swipebox } // la fonction myThemeAdminMenu( ) sera exécutée // quand WordPress mettra en place le menu d'admin add_action( 'admin_menu', 'myThemeAdminMenu' ); function myThemeAdminMenu( ) { add_menu_page( __('Twentytwelve Child options', 'twentytwelve-child' ), // le titre de la page Options de twentytwelve Child 'twentytwelve Child', // le nom de la page dans le menu d'admin 'administrator', // le rôle d'utilisateur requis pour voir cette page 'my-theme-page', // un identifiant unique de la page 'myThemeSettingsPage' // le nom d'une fonction qui affichera la page ); } function myThemeSettingsPage( ) { ?>

Options de mon thème

/>
/>
/>
/>

T'approches pas de mon nid !!

*/ $img = substr($atts['image'], 0, strlen($atts['image']) - 4); if ($atts['caption'] != "") { $zenphoto_img = '
'; } //$zenphoto_img .= ''; $zenphoto_img .= ''; //$zenphoto_img .= ''; $zenphoto_img .= '' . $img . ''; $zenphoto_img .= ''; if ($atts['caption'] != "") { $zenphoto_img .= '

' . $atts['caption'] . '

'; } return $zenphoto_img; } add_shortcode( 'zenphoto', 'zenphoto_handler' ); function zenphoto_full_handler($atts, $content=null) { //utilise le cacheManager de zenphoto (extensions/utilitaires/cacheManager) //utilisation: [zenphoto album="lievres" image="2008-08-18_Lievre_8927.jpg"] // [zenphoto album="sports-mecaniques/gp-france" image="2010-05-23_gp-france-2010_5321.jpg"] //taille des photos dans Worpress, theme Twenty Ten Child : 610x406 //$zenphoto_url = "http://alubook.local/zenphoto/"; $zenphoto_url = get_option( 'zenphoto_url' ); //$size = 610; $size = get_option( 'img_size' ); /*

T'approches pas de mon nid !!

*/ $img = substr($atts['image'], 0, strlen($atts['image']) - 4); if ($atts['caption'] != "") { $zenphoto_img = '
'; } //$zenphoto_img .= ''; $zenphoto_img .= ''; //$zenphoto_img .= ''; $zenphoto_img .= '' . $img . ''; $zenphoto_img .= ''; if ($atts['caption'] != "") { $zenphoto_img .= '

' . $atts['caption'] . '

'; } return $zenphoto_img; } add_shortcode( 'zenphoto_full', 'zenphoto_full_handler' ); /*** /Shortcode zenphoto ***/ /*** SEO ***/ function meta_box_title_description() { add_meta_box( 'parametres_seo_metabox', 'Paramètres SEO', 'parametres_seo_metabox_content', 'post', 'side', 'high' ); add_meta_box( 'parametres_seo_metabox', 'Paramètres SEO', 'parametres_seo_metabox_content', 'page', 'side', 'high' ); } add_action( 'add_meta_boxes', 'meta_box_title_description' ); function parametres_seo_metabox_content($post) { $val_title = get_post_meta($post->ID,'_parametres_seo_title',true); $val_description = get_post_meta($post->ID,'_parametres_seo_description',true); ?>

Title

Meta description

post->ID,'_parametres_seo_description',true) ) { echo ''; } } add_action( 'wp_head', 'modify_description_from_metabox' ); function modify_title_from_metabox($title) { global $wp_query; if ( get_post_meta($wp_query->post->ID,'_parametres_seo_title',true) ) { return get_post_meta($wp_query->post->ID,'_parametres_seo_title',true); } else { return $title; } } add_filter( 'wp_title', 'modify_title_from_metabox' ); /*** /SEO ***/ /*** Fil d'arianne ***/ //Récupérer les catégories parentes function myget_category_parents($id, $link = false,$separator ='/',$nicename = false,$visited = array()) { $chain = '';$parent = &get_category($id); if (is_wp_error($parent))return $parent; if ($nicename)$name = $parent->name; else $name = $parent->cat_name; if ($parent->parent && ($parent->parent != $parent->term_id ) &&!in_array($parent->parent, $visited)) { $visited[] = $parent->parent;$chain .= myget_category_parents($parent->parent, $link, $separator, $nicename, $visited );} if ($link) $chain .= ''.$name.'' . $separator; else $chain .= $name.$separator; return $chain; } //Le rendu function mybread() { // variables gloables global $wp_query;$ped=get_query_var('paged');$rendu = '
'; //$debutlien = 'Vous êtes ici : '.get_bloginfo('name') .''; $debutlien = '' . __('You are here', 'twentytwelve-child' ) . ' : '.get_bloginfo('name') .''; //$debut = 'Vous êtes ici : Accueil de '. get_bloginfo('name') .''; $debut = '' . __('You are here', 'twentytwelve-child' ) . ' : Accueil de '. get_bloginfo('name') .''; // si l'utilisateur a défini une page comme page d'accueil if ( is_front_page() ) {$rendu .= $debut;} // dans le cas contraire else { // on teste si une page a été définie comme devant afficher une liste d'article if( get_option('show_on_front') == 'page') { $url = urldecode(substr($_SERVER['REQUEST_URI'], 1)); $uri = $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; $posts_page_id = get_option( 'page_for_posts'); $posts_page_url = get_page_uri($posts_page_id); $pos = strpos($uri,$posts_page_url); if($pos !== false) { //$rendu .= $debutlien.' » Les articles'; $rendu .= $debutlien.' » ' . __('Posts', 'twentytwelve-child' ) . ''; } else {$rendu .= $debutlien;} } //Si c'est l'accueil elseif ( is_home()) {$rendu .= $debut;} //pour tout le reste else {$rendu .= $debutlien;} // les catégories if ( is_category() ) { $cat_obj = $wp_query->get_queried_object();$thisCat = $cat_obj->term_id;$thisCat = get_category($thisCat);$parentCat =get_category($thisCat->parent); if ($thisCat->parent != 0) $rendu .= " » ".myget_category_parents($parentCat, true, " » ", true); if ($thisCat->parent == 0) $rendu .= " » "; if ( $ped <= 1 ) { //$rendu .= single_cat_title("", false); $rendu .= __('Category', 'twentytwelve-child' ) . " » " . single_cat_title("", false) . ""; } elseif ( $ped > 1 ) { //$rendu .= ''.single_cat_title("", false).''; $rendu .= ''.single_cat_title("", false).''; } } // les auteurs elseif ( is_author()){ //global $author;$user_info = get_userdata($author);$rendu .= " » Articles de l'auteur ".$user_info->display_name."";} global $author;$user_info = get_userdata($author);$rendu .= __(' » Articles de l\'auteur ', 'twentytwelve-child' )."".$user_info->display_name.""; } // les mots clés elseif ( is_tag()){ //$tag=single_tag_title("",FALSE);$rendu .= " » Articles sur le thème ".$tag."";} $tag=single_tag_title("",FALSE);$rendu .= __(' » Articles sur le thème ', 'twentytwelve-child' ).$tag.""; } elseif ( is_date() ) { if ( is_day() ) { global $wp_locale; $rendu .= ''.$wp_locale->get_month(get_query_var('monthnum') ).' '.get_query_var('year').' '; //$rendu .= " » Archives pour ".get_the_date();} $rendu .= __(' » Archives for ', 'twentytwelve-child' ) . get_the_date(); } else if ( is_month() ) { //$rendu .= " » Archives pour ".single_month_title(' ',false);} $rendu .= __(' » Archives for ', 'twentytwelve-child' ) . single_month_title(' ',false); } else if ( is_year() ) { //$rendu .= " » Archives pour ".get_query_var('year');}} $rendu .= __(' » Archives for ', 'twentytwelve-child' ) . get_query_var('year'); } } //les archives hors catégories elseif ( is_archive() && !is_category()){ $posttype = get_post_type(); $tata = get_post_type_object( $posttype ); $var = ''; $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) ); $titrearchive = $tata->labels->menu_name; if (!empty($the_tax)) { $var = $the_tax->labels->name.' '; } if (empty($the_tax)) {$var = $titrearchive; } //$rendu .= ' » Archives sur "'.$var.'"';} $rendu .= __(' » Archives for "', 'twentytwelve-child' ) .$var.'"'; } // La recherche elseif ( is_search()) { //$rendu .= " » Résultats de votre recherche » ".get_search_query()."";} $rendu .= __(' » Search result » ', 'twentytwelve-child' ) . get_search_query().""; } // la page 404 elseif ( is_404()){ //$rendu .= " » 404 Page non trouvée";} $rendu .= __(' » 404 Page not found', 'twentytwelve-child' ); } //Un article elseif ( is_single()){ $category = get_the_category(); $category_id = get_cat_ID( $category[0]->cat_name ); if ($category_id != 0) { $rendu .= " » ".myget_category_parents($category_id,TRUE,' » ')."".the_title('','',FALSE).""; } elseif ($category_id == 0) { $post_type = get_post_type(); $tata = get_post_type_object( $post_type ); $titrearchive = $tata->labels->menu_name; $urlarchive = get_post_type_archive_link( $post_type ); $rendu .= ' » '.$titrearchive.' » '.the_title('','',FALSE).''; } } //Une page elseif ( is_page()) { $post = $wp_query->get_queried_object(); if ( $post->post_parent == 0 ) { $rendu .= " » ".the_title('','',FALSE).""; } elseif ( $post->post_parent != 0 ) { $title = the_title('','',FALSE);$ancestors =array_reverse(get_post_ancestors($post->ID));array_push($ancestors,$post->ID); foreach ( $ancestors as $ancestor ) { if( $ancestor != end($ancestors) ) { $rendu .= '» '. strip_tags( apply_filters('single_post_title', get_the_title( $ancestor ) ) ) .''; } else {$rendu .= ' » '.strip_tags(apply_filters('single_post_title',get_the_title($ancestor))).''; }}}} if ( $ped >= 1 ) { $rendu .= ' (Page '.$ped.')'; } } $rendu .= '
'; echo $rendu; } /*** /Fil d'arianne ***/ if ( ! function_exists( 'twentytwelve_entry_meta' ) ) : /** * Prints HTML with meta information for current post: categories, tags, permalink, author, and date. * * Create your own twentytwelve_entry_meta() to override in a child theme. * * @since Twenty Twelve 1.0 */ function twentytwelve_entry_meta() { // Translators: used between list items, there is a space after the comma. $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); // Translators: used between list items, there is a space after the comma. $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. if ( $tag_list ) { $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'twentytwelve-child' ); } elseif ( $categories_list ) { $utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'twentytwelve-child' ); } else { $utility_text = __( 'This entry was posted on %3$s by %4$s.', 'twentytwelve-child' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } endif; function date_auteur_meta() { // Modif pour human_time_diff $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); $date = sprintf( '', esc_attr( get_the_date( 'c' ) ), //esc_html( get_the_date() ) esc_html( _human_time_diff( get_the_time('U'), current_time('timestamp') ) ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); /* if ( $categories_list ) { $utility_text = __( 'On %2$s by %3$s - %1$s', 'twentytwelve-child' ); } else { $utility_text = __( 'On %2$s by %3$s.', 'twentytwelve-child' ); } */ if ( $categories_list ) { $utility_text = __( '%2$s by %3$s - %1$s', 'twentytwelve-child' ); } else { $utility_text = __( '%2$s by %3$s.', 'twentytwelve-child' ); } printf( $utility_text, $categories_list, $date, $author ); } function date_auteur_meta_post_format() { $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ), get_the_author() ); if ( $categories_list ) { $utility_text = __( 'On %2$s by %3$s - %1$s', 'twentytwelve-child' ); } else { $utility_text = __( 'On %2$s by %3$s.', 'twentytwelve-child' ); } printf( $utility_text, $categories_list, $date, $author ); } /*** Limite la taille du résumé à x caractères ***/ function the_excerpt_max_charlength($charlength) { $a = ""; $excerpt = get_the_excerpt(); $charlength++; if ( mb_strlen( $excerpt ) > $charlength ) { $subex = mb_substr( $excerpt, 0, $charlength - 5 ); $exwords = explode( ' ', $subex ); $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); if ( $excut < 0 ) { $a = mb_substr( $subex, 0, $excut ); } else { $a = $subex; } $a = $a . '[...]'; } else { $a = $excerpt; } return $a; } /*** Renvoie la date de la dernière modif de l'article ***/ function twentytwelve_post_updated() { setlocale(LC_TIME, get_locale()); $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); // '%e %B %Y @ %H:%M' => 14 août 2013 @ 14:09 // '%A, %B %e %Y @ %l:%M %p' => Wednesday, August 14 2013 @ 2:09 PM if ($u_modified_time >= $u_time + 86400) { ?> Article updated the %1$s at %2$s ', 'twentytwelve-child'), sprintf('%1$s', get_the_modified_time('j F Y')), sprintf('%1$s', get_the_modified_time()) */ printf( __( 'Article updated the %1$s', 'twentytwelve-child'), sprintf('%1$s', strftime( __('%A, %B %e %Y @ %l:%M %p', 'twentytwelve-child'), $u_modified_time)) ); } } /*** returns the name of one random file from within a directory content-livre.php ***/ function getRandomFile($start_dir) { chdir($start_dir); $dir = opendir('.'); while (($myfile = readdir($dir)) !==false) { if ($myfile != '.' && $myfile != '..' && is_file($myfile) && $myfile != 'resource.frk') $files[] = $myfile; } closedir($dir); chdir('../'); srand ((float) microtime() * 10000000); $file = array_rand($files); return $files[$file]; } /*** /returns the name of one random file from within a directory ***/ /*** Shortcode pour afficher la liste des liens [show_bookmark_image_list] ***/ function show_bookmark_list(){ ?> false ), $atts)); $args = array( 'orderby' => 'name', 'order' => 'ASC', 'category_name' => $catagory_name ); if ( $catagory_name == false ) $bookmarks = get_bookmarks(); else $bookmarks = get_bookmarks($args); ob_start(); echo ""; $list = ob_get_clean(); return $list; } add_shortcode('show_bookmark_image_list', 'show_bookmark_image_list'); //end show_bookmark_image_list /* affiche la 1ere image d'un article 1. la post_thumbail (image à la une) 2. champ personnalisé (post custom) 3. 1ere image du content 4. image par défaut */ function first_image($article) { $first_img = ""; $metas = get_post_custom($article); if (has_post_thumbnail($article)) { $output = preg_match_all('//i', get_the_post_thumbnail( $article ), $matches); $first_img = $matches [1] [0]; //echo $article . " -- " . $first_img . " hpt

"; } elseif ( isset($metas['thumb_zenphoto'][0]) ) { $first_img = $metas['thumb_zenphoto'][0]; // http://alubook.local/zenphoto/cache/gp-france-2010/2010-05-23_gp-france-2010_5327_610_watermark.jpg //echo $article . " -- " . $first_img . " tz

"; } else { $output = preg_match_all('//i', get_the_content($article), $matches); $first_img = $matches [1] [0]; //echo $article . " -- " . $first_img . " preg

"; if(empty($first_img)) { //$first_img = "http://alubook.local/wordpress/wp-content/themes/twentytwelve-child/images/ampoules.jpg"; $first_img = get_bloginfo('stylesheet_directory') . "/images/ampoules.jpg"; //echo $article . " -- " . $first_img . " ampoule

"; } } return $first_img; } if ( ! function_exists( 'twentytwelve_comment' ) ) : /** * Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own twentytwelve_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Twenty Twelve 1.0 */ function twentytwelve_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    %1$s %2$s', get_comment_author_link(), // If current post author is also comment author, make it known visually. ( $comment->user_id === $post->post_author ) ? '' . __( 'Post author', 'twentytwelve' ) . '' : '' ); printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), /* translators: 1: date, 2: time */ sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'twentytwelve' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    exists() ? $user->display_name : ''; if ( ! isset( $args['format'] ) ) $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html5 = 'html5' === $args['format']; $fields = array( 'author' => '

    ' . ' ' . '

    ', 'email' => '', 'url' => '

    ' . '

    ', ); $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); $defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => '

    ', 'must_log_in' => '', 'logged_in_as' => '

    ' . sprintf( __( 'Logged in as %2$s. Log out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '

    ', 'comment_notes_before' => '

    ' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '

    ', 'comment_notes_after' => '

    ' . sprintf( __( 'You may use these HTML tags and attributes: %s' ), ' ' . allowed_tags() . '' ) . '

    ', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __( 'Leave a Reply' ), 'title_reply_to' => __( 'Leave a Reply to %s' ), 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'format' => 'xhtml', ); $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); ?>

    > $field ) { echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; } do_action( 'comment_form_after_fields' ); ?>

    requis pour masquer le formulaire */ function no_comment_form( $args = array(), $post_id = null ) { if ( null === $post_id ) $post_id = get_the_ID(); else $id = $post_id; $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; if ( ! isset( $args['format'] ) ) $args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml'; $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html5 = 'html5' === $args['format']; $fields = array( 'author' => '

    ' . ' ' . '

    ', 'email' => '', 'url' => '

    ' . '

    ', ); $required_text = sprintf( ' ' . __('Required fields are marked %s'), '*' ); $defaults = array( 'fields' => apply_filters( 'comment_form_default_fields', $fields ), 'comment_field' => '

    ', 'must_log_in' => '', 'logged_in_as' => '

    ' . sprintf( __( 'Logged in as %2$s. Log out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '

    ', 'comment_notes_before' => '

    ' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '

    ', 'comment_notes_after' => '

    ' . sprintf( __( 'You may use these HTML tags and attributes: %s' ), ' ' . allowed_tags() . '' ) . '

    ', 'id_form' => 'commentform', 'id_submit' => 'submit', 'title_reply' => __( ' → Leave a Reply' ), 'title_reply_to' => __( 'Leave a Reply to %s' ), 'cancel_reply_link' => __( 'Cancel reply' ), 'label_submit' => __( 'Post Comment' ), 'format' => 'xhtml', ); $args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) ); ?> Afficher '; ?>

    > $field ) { echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; } do_action( 'comment_form_after_fields' ); ?>

    = HOUR_IN_SECONDS ) { $hours = round( $diff / HOUR_IN_SECONDS ); if ( $hours <= 1 ) $hours = 1; $since = sprintf( _n( '%s hour ago', '%s hours ago', $hours, 'twentytwelve-child' ), $hours ); } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) { $days = round( $diff / DAY_IN_SECONDS ); if ( $days <= 1 ) $days = 1; $since = sprintf( _n( '%s day ago', '%s days ago', $days, 'twentytwelve-child' ), $days ); } elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) { $weeks = round( $diff / WEEK_IN_SECONDS ); if ( $weeks <= 1 ) $weeks = 1; $since = sprintf( _n( '%s week ago', '%s weeks ago', $weeks, 'twentytwelve-child' ), $weeks ); } else { /* } elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) { $months = round( $diff / ( 30 * DAY_IN_SECONDS ) ); if ( $months <= 1 ) $months = 1; */ //$since = sprintf( _n( '%s month', '%s months', $months ), $months ); //$since = __('The', 'twentytwelve-child') . " " . get_the_date(); $since = sprintf( __( 'The %s', 'twentytwelve-child' ), get_the_date() ); /* } elseif ( $diff >= YEAR_IN_SECONDS ) { $years = round( $diff / YEAR_IN_SECONDS ); if ( $years <= 1 ) $years = 1; $since = sprintf( _n( '%s year', '%s years', $years ), $years );*/ } return $since; } ?>