• I used below PHP code below to customize the author and published date (entry-meta) and want to reposition it from its default position below the thumbnail (title – thumbnail – entry meta). But I don’t know why the function of repositioning stops working. Is there even an easier way to achieve this function?

    // Modify the post author and date output
    add_filter(‘generate_post_author_output’, function () {
    return sprintf(
    ‘%1$s’,
    sprintf(
    ‘Author: %s’,
    esc_html(get_the_author())
    )
    );
    });
    // post date
    add_filter(‘generate_post_date_output’, function ($output, $time_string) {
    $time_string = ‘%2$s’;
    $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())
    );
    return sprintf(


    Published Date: %s’,
    $time_string
    );
    }, 10, 2);

    add_filter(‘generate_header_entry_meta_items’, function () {
    return array(‘date’, ‘author’);
    });

    add_filter(‘generate_footer_entry_meta_items’, ‘__return_null’);

    //reposition
    function tu_move_posted_on() {
    if (is_single()) {
    remove_action(‘generate_after_entry_title’, ‘generate_post_meta’, 10);
    add_action(‘generate_after_entry_header’, ‘generate_post_meta’, 20);
    }
    }
    add_action(‘init’, ‘tu_move_posted_on’);

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Published Date and Author Customization’ is closed to new replies.