Change function to use with filters and change the name.

This commit is contained in:
Fabiano Alencar 2018-09-17 15:29:36 -03:00
parent 30901a33e9
commit 6bf39376a4
6 changed files with 23 additions and 13 deletions

View File

@ -20,6 +20,9 @@
}
}
.blog-content{
font-size: 0.75rem;
font-weight: 400;
color: #898d8f;
&.blog-flex{
@media screen {
@media (min-width: 768px) {
@ -38,6 +41,7 @@
}
.text-black{
font-weight: 400;
font-size: 1rem;
}
time{
font: {

View File

@ -57,14 +57,25 @@ add_filter( 'comment_text', 'wrap_Comment', 99);
/**
* Display date of post.
*/
function tainacan_post_date() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
function tainacan_meta_date_author($echo = true) {
$time = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
$time_string = sprintf( $time_string,
$time_string = sprintf( $time,
esc_attr( get_the_date( 'c' ) ),
get_the_date()
);
echo $time_string;
$string = $time_string;
$string .= __('&nbsp;by&nbsp;', 'tainacan-theme');
$string .= get_the_author_posts_link();
$string = apply_filters('tainacan-meta-date-author', $string);
if ($echo) {
echo $string;
} else {
return $string;
}
}
// define the cancel_comment_reply_link callback

View File

@ -22,8 +22,7 @@
<article role="article" id="post_<?php the_ID()?>" <?php post_class()?>>
<header class="mb-4">
<div class="header-meta text-muted mb-5">
<span class="time"><?php tainacan_post_date(); ?></span>
<?php printf(__('by %s', 'tainacan-theme'), get_the_author_posts_link()); ?>
<span class="time"><?php tainacan_meta_date_author(); ?></span>
</div>
</header>
<?php if (tainacan_has_document()): ?>

View File

@ -9,8 +9,8 @@
<a href="<?php the_permalink(); ?>" class="font-weight-bold"><?php the_title(); ?></a>
</h3>
<?php echo '<p class="text-black">'.wp_trim_words( get_the_excerpt(), 28, '...').'</p>'; ?>
<?php tainacan_post_date(); ?>
<span style="font-size: 0.75rem; font-weight: 400; color: #898d8f;"> <?php printf(__('by %s', 'tainacan-theme'), get_the_author_posts_link()); ?></span>
<?php tainacan_meta_date_author(); ?>
<a href="<?php the_permalink(); ?>" class="readmore float-right screen-reader-text"><?php _e('Read more...', 'tainacan-theme'); ?></a>
</div>
</div>

View File

@ -21,10 +21,6 @@
<?php else : ?>
<p style="font-style: italic;"><?php _e('Description not informed'); ?></p>
<?php endif; ?>
<!-- <p>
<?php //_e('Create by: ');?> <?php //the_author(); ?><br>
<?php //_e('Date: ');?> <?php //tainacan_post_date(); ?>
</p> -->
</div>
</div>
</a>

View File

@ -2,7 +2,7 @@
<header class="mb-4">
<div class="header-meta text-muted mb-5 d-flex">
<?php if(!is_singular('page')) { ?>
<?php tainacan_post_date(); ?> &nbsp;<?php printf(__('by&nbsp;%s', 'tainacan-theme'), get_the_author_posts_link()); ?>
<?php tainacan_meta_date_author(); ?>
<?php } ?>
<div class="btn-group ml-auto" role="group">
<?php if ( true == get_theme_mod( 'facebook_share', true ) ) : ?>