Affichage date

Résolu
caro__48 Messages postés 242 Date d'inscription   Statut Membre Dernière intervention   -  
caro__48 Messages postés 242 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Je débute en wordpress et je souhaite intégrer automatiquement ma date de publication dans mes articles.

Je me sers du thème Mystique 2.

Quelqu'un peut-il m'aider?
Merci

2 réponses

Jeyzzi
 
Bonjour !

Pour intégrer et modifier une date de publication dans votre blog wordpress, voici une vidéo qui pourrait vous aider :
http://www.fredericbouffier.com/blog/formation/327/video-modifier-la-date-de-publication-dans-votre-blog-wordpress/
0
caro__48 Messages postés 242 Date d'inscription   Statut Membre Dernière intervention   61
 
J'ai compris comment modifier la date mais pas comment l'afficher dans mes articles, cela ne marche pas.
Je ne comprend pas.
0
Jeyzzi
 
Pour afficher la date actuelle telle que définie dans votre tableau de bord > Réglages > Général, on va utiliser la fonction php date()

1 <?php echo date(get_option('date_format')); ?>

Pour afficher l'heure actuelle telle que définie dans votre tableau de bord > Réglages > Général

1 <?php echo date(get_option('time_format')); ?>

Toutes les infos ici --> http://www.bygga.fr/comment-facilement-afficher-une-date-et-une-heure-sur-wordpress/
0
caro__48 Messages postés 242 Date d'inscription   Statut Membre Dernière intervention   61
 
ta réponse me permet bien d'avancer mais je vais vraiment faire ma blonde.

Je dois mettre le code <p>Date de publication : <?php the_date(); ?></p>

dans ma boucle wordpress et je dois avouer que je ne comprend pas grand chose.
Sais tu ou je dois le mettre??

Voici le code de ma page single.php

<?php
/* Mystique/digitalnature */
get_header();
?>

<!-- main content: primary + sidebar(s) -->
<div id="main">
<div id="main-inside" class="clear-block">
<!-- primary content -->
<div id="primary-content">
<div class="blocks"><!-- single -->
<?php do_action('mystique_before_primary'); ?>
<?php if (have_posts()) : while (have_posts()): the_post(); ?>

<div class="single-navigation clear-block">
<?php
if (function_exists('yoast_breadcrumb')) {
yoast_breadcrumb('<p id="breadcrumbs">', '</p>');
} else {
?>
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
<div class="alignright"><?php next_post_link('%link »') ?></div>
<?php } ?>
</div>

<!-- post -->
<div id="post-<?php the_ID(); ?>" class="<?php mystique_post_class('single'); ?>">

<?php if (!get_post_meta($post->ID, 'hide_title', true)): ?><h1 class="title"><?php the_title(); ?></h1><?php endif; ?>

<div class="post-content clear-block">
<?php the_content(__('More >', 'mystique')); ?>
<?php if (function_exists('wp_print')): ?><div class="alignright"><?php print_link(); ?></div><?php endif; ?>
</div>
<?php wp_link_pages(array('before' => '<div class="page-navigation"><p><strong> ' . __("Pages:", "mystique") . ' </strong>', 'after' => '</p></div>', 'next_or_number' => 'number')); ?>

<?php
$settings = get_option('mystique');
$post_tags = get_the_tags();
if ($post_tags && $settings['post_single_tags']):
?>
<div class="post-tags">
<?php
$tags = array();
$i = 0;
foreach ($post_tags as $tag):
$tags[$i] .= '<a href="' . get_tag_link($tag->term_id) . '" rel="tag" title="' . sprintf(__('%1$s (%2$s topics)'), $tag->name, $tag->count) . '">' . $tag->name . '</a>';
$i++;
endforeach;
echo implode(', ', $tags);
?>
</div>
<?php endif; ?>


<?php if ($settings['post_single_author']): ?>
<div class="about_the_author clear-block">
<div class="avatar">
<a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" title="<?php echo get_the_author(); ?>"><?php echo mystique_get_avatar(get_the_author_meta('email'), 80); ?></a>
</div>
<h3><?php _e("About the author", "mystique"); ?></h3>
<p><?php the_author_meta('description'); ?></p>
</div>
<?php endif; ?>

</div>
<!-- /post -->

<?php if ($settings['post_single_meta'] || $settings['post_single_share'] || $settings['post_single_print']): ?>
<table class="post-meta">
<tr>
<?php if ($settings['post_single_share'] && $settings['jquery']): ?><td><?php mystique_shareThis(); ?></td><?php endif; ?>
<?php if ($settings['post_single_print'] && $settings['jquery']): ?><td><a class="control print"><?php _e("Print article", "mystique"); ?></a> </td><?php endif; ?>
<?php if ($settings["post_single_meta"]): ?>
<td class="details">
<?php
printf(__('This entry was posted by %1$s on %2$s at %3$s, and is filed under %4$s. Follow any responses to this post through %5$s.', 'mystique'), '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . sprintf(__("Posts by %s", "mystique"), attribute_escape(get_the_author())) . ' ">' . get_the_author() . '</a>', get_the_time(get_option('date_format')), get_the_time(get_option('time_format')), get_the_category_list(', '), '<a href="' . get_post_comments_feed_link($post->ID) . '" title="RSS 2.0">RSS 2.0</a>');
echo ' ';

if (('open' == $post->comment_status) && ('open' == $post->ping_status)): // Both Comments and Pings are open
printf(__('You can <a%1$s>leave a response</a> or <a%2$s>trackback</a> from your own site.', 'mystique'), ' href="#respond"', ' href="' . trackback_url('', false) . '" rel="trackback"');
elseif (!('open' == $post->comment_status) && ('open' == $post->ping_status)): // Only Pings are Open
printf(__('Responses are currently closed, but you can <a%1$s>trackback</a> from your own site.', 'mystique'), ' href="' . trackback_url('', false) . '" rel="trackback"');
elseif (('open' == $post->comment_status) && !('open' == $post->ping_status)): // Comments are open, Pings are not
_e('You can skip to the end and leave a response. Pinging is currently not allowed.', 'mystique');
elseif (!('open' == $post->comment_status) && !('open' == $post->ping_status)): // Neither Comments, nor Pings are open
_e('Both comments and pings are currently closed.', 'mystique');
endif;

edit_post_link(__('Edit this entry', 'mystique'));
?>
</td>
<?php endif; ?>
</tr>
</table>
<?php endif; ?>

<?php endwhile;
endif; ?>

<?php comments_template(); ?>
<?php do_action('mystique_after_primary'); ?>
</div>
</div>
<!-- /primary content -->

<?php get_sidebar(); ?>

</div>
</div>
<!-- /main content -->

<?php get_footer(); ?>


Merci Merci
0
Djackq Messages postés 9 Date d'inscription   Statut Membre Dernière intervention  
 
Bonjour

Comme le dit Jeyzzi dans ton tableau de bord wordpress tu vas dans la colonne de gauche tu recherche réglages ensuite général et dans le bas de la page tu coche ton format de date, heure ça devrait fonctionner tu n'a pas à rentrer dans le code PHP. Ne cherche pas à bidouiller le code tu vas faire plus de mal que de bien.
0
caro__48 Messages postés 242 Date d'inscription   Statut Membre Dernière intervention   61
 
ah ben oui j'ai tout ré-paramétré alors que je l'avais déjà fait et ça marche! Allez comprendre!!

Merci beaucoup pour votre aide.
0