Skip to main content
deleted 1440 characters in body
Source Link

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

if (!function_exists('colormag_entry_meta')) :

/**
 * Shows meta information of post.
 */
function colormag_entry_meta() {
    if ('post' == get_post_type()) :
        echo '<div class="below-entry-meta">';
        ?>

        <?php
        $cur_cat = get_query_var('cat');
        $check_cat_nodate = array(12, 13,14,15);
        if (in_array($cur_cat, $check_cat_nodate)) {
        }
        else{
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
            if (get_the_time('U') !== get_the_modified_time('U')) {
                $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
            }
            $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())
            );
            printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
            );
        }
        ?>


        <?php if (!post_password_required() && comments_open()) { ?>

            <?php
        }
        $tags_list = get_the_tag_list('<span class="tag-links"><i class="fa fa-tags"></i>', __(', ', 'colormag'), '</span>');
        if ($tags_list)
            echo $tags_list;

        edit_post_link(__('Edit', 'colormag'), '<span class="edit-link">', '</span>');

        echo '</div>';
    endif;
}

endif;

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

if (!function_exists('colormag_entry_meta')) :

/**
 * Shows meta information of post.
 */
function colormag_entry_meta() {
    if ('post' == get_post_type()) :
        echo '<div class="below-entry-meta">';
        ?>

        <?php
        $cur_cat = get_query_var('cat');
        $check_cat_nodate = array(12, 13,14,15);
        if (in_array($cur_cat, $check_cat_nodate)) {
        }
        else{
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
            if (get_the_time('U') !== get_the_modified_time('U')) {
                $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
            }
            $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())
            );
            printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
            );
        }
        ?>


        <?php if (!post_password_required() && comments_open()) { ?>

            <?php
        }
        $tags_list = get_the_tag_list('<span class="tag-links"><i class="fa fa-tags"></i>', __(', ', 'colormag'), '</span>');
        if ($tags_list)
            echo $tags_list;

        edit_post_link(__('Edit', 'colormag'), '<span class="edit-link">', '</span>');

        echo '</div>';
    endif;
}

endif;

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

 printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
            );
      
Post Undeleted by Shamima Saleem
Post Deleted by Shamima Saleem
added 1423 characters in body
Source Link

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

printfif (!function_exists('colormag_entry_meta')) :

/**
 * Shows meta information of post.
 */
function colormag_entry_meta() {
    if ('post' == get_post_type()) :
        echo '<div class="below-entry-meta">';
        ?>

        <?php
        $cur_cat = get_query_var('cat');
        $check_cat_nodate = array(12, 13,14,15);
        if (in_array($cur_cat, $check_cat_nodate)) {
        }
        else{
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
            if (get_the_time('U') !== get_the_modified_time('U')) {
                $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
            }
            $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())
            );
            printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
    esc_url        );
        }
        ?>


        <?php if (get_permalink!post_password_required() && comments_open()), { ?>

    esc_attr        <?php
        }
        $tags_list = get_the_tag_list(get_the_time'<span class="tag-links"><i class="fa fa-tags"></i>', __()', ', 'colormag'), '</span>');
    $time_string    if ($tags_list)
            echo $tags_list;

        edit_post_link(__('Edit', 'colormag'), '<span class="edit-link">', '</span>'); 

        echo '</div>';
    endif;
}

endif;

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

printf(
    __('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), 
    esc_url(get_permalink()),
    esc_attr(get_the_time()),
    $time_string
);

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

if (!function_exists('colormag_entry_meta')) :

/**
 * Shows meta information of post.
 */
function colormag_entry_meta() {
    if ('post' == get_post_type()) :
        echo '<div class="below-entry-meta">';
        ?>

        <?php
        $cur_cat = get_query_var('cat');
        $check_cat_nodate = array(12, 13,14,15);
        if (in_array($cur_cat, $check_cat_nodate)) {
        }
        else{
            $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
            if (get_the_time('U') !== get_the_modified_time('U')) {
                $time_string .= '<time class="updated" datetime="%3$s">%4$s</time>';
            }
            $time_string = sprintf($time_string, esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_attr(get_the_modified_date('c')), esc_html(get_the_modified_date())
            );
            printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string
            );
        }
        ?>


        <?php if (!post_password_required() && comments_open()) { ?>

            <?php
        }
        $tags_list = get_the_tag_list('<span class="tag-links"><i class="fa fa-tags"></i>', __(', ', 'colormag'), '</span>');
        if ($tags_list)
            echo $tags_list;

        edit_post_link(__('Edit', 'colormag'), '<span class="edit-link">', '</span>'); 

        echo '</div>';
    endif;
}

endif;

Improved formatting, removed thanks
Source Link
kero
  • 6.3k
  • 1
  • 23
  • 34

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

Please help me. Thank you.

printf(
    __('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), 
    esc_url(get_permalink()),
    esc_attr(get_the_time()),
    $time_string 
);

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

Please help me. Thank you.

printf(__('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), esc_url(get_permalink()), esc_attr(get_the_time()), $time_string);

I'm trying to translate the post date using __() function. But it is not working. The post date still displayed in English.

What are you the other options to localize the post date(posted-on).

printf(
    __('<span class="posted-on"><a href="%1$s" title="%2$s" rel="bookmark"><i class="fa fa-clock-o"></i> %3$s</a></span>', 'colormag'), 
    esc_url(get_permalink()),
    esc_attr(get_the_time()),
    $time_string 
);
Source Link
Loading