New Landing How can we help? Atelier Recent Post Formatting Date

Viewing 13 posts - 1 through 13 (of 13 total)
  • Posted in: Atelier
  • #254192
    Patrick-H
    Member
    Post count: 20

    Hi,
    i´m using the pagebuilder Recent Posts element (Standard, 3 Col, 3 Items) and need the post date in the format d-m-Y: day (Numeric, with leading zeros ), month (Numeric, with leading zeros) and year (Numeric, 4 digits). How to change/ where to look in the code?!

    Thanks in advance!
    Patrick

    #254273
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please open to edit sf-post-formats.php file at /atelier/swift-framework/content/.

    Find this code:-

    $post_date_str  = get_the_date('Y-m-d');
    

    Change to:-
    $post_date_str = get_the_date('d-m-Y');

    Thanks
    Mohammad

    #254939
    Patrick-H
    Member
    Post count: 20

    Thanks for your reply, but it does not work – recent posts (via pagebuilder) still have the date format M-d, the archive page M-d-Y. It would be great if both have d-m-Y.

    Thanks in advance.

    #255177
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Have you set that format in the WordPress Settings?

    – Kyle

    #255307
    Patrick-H
    Member
    Post count: 20

    Hi.

    yes, the format in the wordpress settings is d.m.Y

    Patrick

    #255310
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    You will need to edit this section of the sf-post-formats.php file:

    // Open output            
                if ( sf_theme_opts_name() == "sf_atelier_options" && $show_details == "yes" ) {
    	    		$post_item .= '<div class="side-details">';
    	    		if ( !$remove_dates ) {
    	    			$post_date_month = get_the_date('M');
    	    			$post_date_day = get_the_date('d');
    	    			$post_date_year = get_the_date('Y');
    	    			$post_item .= '<div class="side-post-date narrow-date-block" itemprop="datePublished"><span class="month">'.$post_date_month.'</span><span class="day">'.$post_date_day.'</span><span class="year">'.$post_date_year.'</span></div>';
    	    		}

    – Kyle

    #255512
    Patrick-H
    Member
    Post count: 20

    Thanks for your reply.

    Editing this section just changes the format on the blog (archive) page; no effect on the recent posts element (via pagebuilder).

    Any idea where to find the section for that (recent posts element)?

    Thanks in advance!
    Patrick

    #255997
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Can you please send me a link to the page and a log in so I can look into this for you

    – Kyle

    #256134
    Patrick-H
    Member
    Post count: 20
    This reply has been marked as private.
    #256413
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Hi,

    I made 2 changes to achieved that.

    1- I added this css to your custom css option

    .home .recent-posts .figure-wrap .date-overlay {
        width: 90px;
    }

    2-

    function sf_custom_date_figure_overlay() {
    		global $post, $sf_options;
    		$remove_dates  = $sf_options['remove_dates'];
    
    		if ($remove_dates) {
    			return;
    		}
    
    		$post_date = get_the_date('d-m-Y');
    		
    		return '<div class="date-overlay narrow-date-block"><span class="month">'.$post_date.'</span></div>';
    
    	}
    	add_filter( 'sf_before_recent_post_thumb', 'sf_custom_date_figure_overlay' );
    
    	function sf_remove_filters(){
    		remove_filter( 'sf_before_recent_post_thumb', 'sf_date_figure_overlay' );
    	}
    
    	add_action('init', 'sf_remove_filters');

    Hope it helps.

    -Rui

    #256480
    Patrick-H
    Member
    Post count: 20

    It helps – Thank you very much!

    Patrick

    #256481
    Patrick-H
    Member
    Post count: 20

    Resolved.

    Thank you.

    #256605
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Great thanks to Kyle.
    Mohammad

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register