Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › Date format
New Landing › How can we help? › Themeforest Theme Support › Uplift › Date format
- This topic has 4 replies, 3 voices, and was last updated 8 years by Mohammad – SUPPORT.
-
Posted in: Uplift
-
August 3, 2016 at 12:31 pm #285676
I know that this is a little out of scope of your support. If you give me any advice it would be great.
In recent posts module I would like to change the date format from August 3, 2016 to 03 AUG 16.
Any help would be very much apperciated.
-Peter
August 3, 2016 at 12:46 pm #285680Hi
Have you changed the date format in the wordpress settings?
– Kyle
August 3, 2016 at 12:50 pm #285682Hi,
Please go to Admin > General > Date format > Choose custom > Insert this value > M d, Y.
Thanks
MohammadAugust 3, 2016 at 6:25 pm #285739Could you please point me at which line and which .php file is the date format located for the Recent posts (post list). I wanted something more radical in mind.
I want the date to be formated:
16
—
NOVThanks
August 4, 2016 at 6:00 am #285797Hi,
Please paste this code at functions.php of child theme first :-function sf_get_recent_post_item( $post, $display_type = "bold", $excerpt_length = 20, $item_class = "" ) { $recent_post = $recent_post_figure = $link_config = $item_icon = ""; $thumb_type = sf_get_post_meta( $post->ID, 'sf_thumbnail_type', true ); $thumb_image = rwmb_meta( 'sf_thumbnail_image', 'type=image&size=full' ); $thumb_video = sf_get_post_meta( $post->ID, 'sf_thumbnail_video_url', true ); $thumb_gallery = rwmb_meta( 'sf_thumbnail_gallery', 'type=image&size=thumb-image' ); foreach ( $thumb_image as $detail_image ) { $thumb_img_url = $detail_image['url']; break; } if ( ! $thumb_image ) { $thumb_image = get_post_thumbnail_id(); $thumb_img_url = wp_get_attachment_url( $thumb_image, 'full' ); } // POST META $sf_options = sf_get_theme_opts(); $single_author = $sf_options['single_author']; $remove_dates = $sf_options['remove_dates']; $post_links_match_thumb = false; if ( isset( $sf_options['post_links_match_thumb'] ) ) { $post_links_match_thumb = $sf_options['post_links_match_thumb']; } if ( $display_type == "list" ) { //$excerpt_length = 8; } $post_author = get_the_author_link(); $post_date = get_the_date(); $post_date_str = get_the_date('Y-m-d'); $item_title = get_the_title(); $post_permalink = get_permalink(); $post_comments = get_comments_number(); $custom_excerpt = sf_get_post_meta( $post->ID, 'sf_custom_excerpt', true ); $post_excerpt = ''; $post_categories = ''; if ( $custom_excerpt != '' ) { $post_excerpt = sf_custom_excerpt( $custom_excerpt, $excerpt_length ); } else { $post_excerpt = sf_excerpt( $excerpt_length ); } $post_permalink_config = 'href="' . $post_permalink . '" class="link-to-post"'; if ( $post_links_match_thumb ) { $link_config = sf_post_item_link(); $post_permalink_config = $link_config['config']; } if ( function_exists('sf_get_custom_post_cat_list') ) { $post_categories = sf_get_custom_post_cat_list( $post->ID ); } $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 720); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 540); if ( strpos($item_class, 'col-sm-3') !== false ) { $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 300); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 225); } if ( strpos($item_class, 'col-sm-3') !== false ) { $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 400); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 300); } if ( $display_type == "standard-row" ) { $thumb_width = apply_filters('sf_recent_post_item_thumb_width', 400); $thumb_height = apply_filters('sf_recent_post_item_thumb_height', 300); } if ( $display_type == "showcase" ) { $thumb_width = apply_filters('sf_recent_post_item_showcase_thumb_width', 600); $thumb_height = apply_filters('sf_recent_post_item_showcase_thumb_height', 450); } // MEDIA CONFIG $thumb_link_type = sf_get_post_meta( $post->ID, 'sf_thumbnail_link_type', true ); $thumb_link_url = sf_get_post_meta( $post->ID, 'sf_thumbnail_link_url', true ); $thumb_lightbox_thumb = rwmb_meta( 'sf_thumbnail_image', 'type=image&size=large' ); $thumb_lightbox_image = rwmb_meta( 'sf_thumbnail_link_image', 'type=image&size=large' ); $thumb_lightbox_video_url = sf_get_post_meta( $post->ID, 'sf_thumbnail_link_video_url', true ); $thumb_lightbox_video_url = sf_get_embed_src( $thumb_lightbox_video_url ); $thumb_lightbox_img_url = wp_get_attachment_url( $thumb_lightbox_image, 'full' ); // LINK CONFIG $item_link = sf_post_item_link(); if ( $thumb_type == "none" ) { $recent_post .= '<div class="recent-post no-thumb ' . $item_class . ' clearfix">'; } else { $recent_post .= '<div class="recent-post has-thumb ' . $item_class . ' clearfix">'; } $recent_post_figure .= '<div class="figure-wrap">'; $recent_post_figure .= apply_filters( 'sf_before_recent_post_thumb' , ''); $recent_post_figure .= '<figure class="animated-overlay overlay-alt">'; if ( $thumb_type == "video" ) { $video = sf_video_embed( $thumb_video, 400, 225 ); $recent_post_figure .= '<div class="video-thumb">' . $video . '</div>'; } else if ( $thumb_type == "slider" ) { $recent_post_figure .= '<div class="flexslider thumb-slider"><ul class="slides">'; foreach ( $thumb_gallery as $image ) { $alt = $image['alt']; if ( ! $alt ) { $alt = $image['title']; } $recent_post_figure .= "<li><a " . $item_link['config'] . "><img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$alt}' /></a></li>"; } $recent_post_figure .= '</ul></div>'; } else { if ( $thumb_img_url == "" && $thumb_type != "none" ) { $thumb_img_url = "default"; } $image = sf_aq_resize( $thumb_img_url, $thumb_width, $thumb_height, true, false ); if ( $image ) { if ( $post_categories != "" && $display_type != "standard-row" ) { $recent_post_figure .= '<div class="post-cats">'.$post_categories.'</div>'; } $recent_post_figure .= '<div class="img-wrap"><img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" /></div>'; $recent_post_figure .= '<a ' . $item_link['config'] . '></a>'; $recent_post_figure .= '<div class="figcaption-wrap"></div>'; if ( $display_type == "showcase" ) { $recent_post_figure .= '<figcaption><div class="thumb-info">'; $recent_post_figure .= '<h5><span class="post-date updated">' . $post_date . '</span></h5>'; $recent_post_figure .= '<h4>' . $item_title . '</h4>'; $recent_post_figure .= '</div></figcaption>'; } else { $recent_post_figure .= '<figcaption><div class="thumb-info thumb-info-alt">'; if ( $item_link['svg_icon'] != "" ) { $recent_post_figure .= $item_link['svg_icon']; } else { $recent_post_figure .= '<i class="' . $item_link['icon'] . '"></i>'; } $recent_post_figure .= '</div></figcaption>'; } } } $recent_post_figure .= '</figure>'; $recent_post_figure .= '</div>'; if ( $display_type == "bold" ) { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; if ( $thumb_type == "none" ) { $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; } else { $recent_post .= '<h3><a ' . $post_permalink_config . '>' . $item_title . '</a></h3>'; } $recent_post .= sf_get_post_details($post->ID, true); $recent_post .= '</div>'; } else if ( $display_type == "list" ) { if ( $thumb_img_url == "" && $thumb_type != "none" ) { $thumb_img_url = "default"; } $image = sf_aq_resize( $thumb_img_url, 70, 70, true, false ); $recent_post .= '<a class="list-post-link" href="' . $post_permalink . '"></a>'; if ( $image ) { $recent_post .= '<figure class="animated-overlay">'; $recent_post .= '<img itemprop="image" src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $item_title . '" />'; $recent_post .= '<a ' . $item_link['config'] . '></a>'; $recent_post .= '<div class="figcaption-wrap"></div>'; $recent_post .= '<figcaption><div class="thumb-info thumb-info-alt">'; if ( $item_link['svg_icon'] != "" ) { $recent_post .= $item_link['svg_icon']; } else { $recent_post .= '<i class="' . $item_link['icon'] . '"></i>'; } $recent_post .= '</div></figcaption>'; $recent_post .= '</figure>'; } $recent_post .= '<div class="details-wrap">'; $recent_post .= '<h4>' . $item_title . '</h4>'; $recent_post .= '<div class="post-item-details">'; if ( sf_theme_supports('alt-recent-post-list') ) { $recent_post .= '<div class="excerpt">' . $post_excerpt . '</div>'; $recent_post .= sf_get_post_details($post->ID, true); } else { $recent_post .= '<span class="post-date updated">' . $post_date . '</span>'; } $recent_post .= '</div>'; $recent_post .= '</div>'; } else if ( $display_type == "bright" ) { $recent_post .= '<div class="details-wrap">'; $recent_post .= '<div class="author-avatar">' . get_avatar( get_the_author_meta( 'ID' ), '140' ) . '</div>'; $recent_post .= '<h6 class="post-item-author"><span class="author">' . sprintf( '<a href="%2$s" rel="author" itemprop="author">%1$s</a>', $post_author, get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '</span></h6>'; $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; $recent_post .= '<div class="post-item-details">'; $recent_post .= '<span class="post-date updated">' . $post_date . '</span>'; $recent_post .= '</div>'; $recent_post .= '</div>'; } else if ( $display_type == "bold" ) { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; if ( $thumb_type == "none" ) { $recent_post .= '<h2><a ' . $post_permalink_config . '>' . $item_title . '</a></h2>'; } else { $recent_post .= '<h3><a ' . $post_permalink_config . '>' . $item_title . '</a></h3>'; } $recent_post = sf_get_post_details($post->ID, true); $recent_post .= '</div>'; } else if ( $display_type == "showcase" ) { $recent_post .= $recent_post_figure; } else { $recent_post .= $recent_post_figure; $recent_post .= '<div class="details-wrap">'; if ( $post_categories != "" && $display_type == "standard-row" ) { $recent_post .= '<div class="post-cats">'.$post_categories.'</div>'; } $recent_post .= '<h5><a ' . $post_permalink_config . '>' . $item_title . '</a></h5>'; $recent_post .= sf_get_post_details($post->ID, true); if ( $excerpt_length != "0" && $excerpt_length != "" ) { $recent_post .= '<div class="excerpt">' . $post_excerpt . '</div>'; } if ( sf_theme_opts_name() == "sf_atelier_options" && $display_type == "standard-row" ) { $recent_post .= '<a class="read-more-button" href="' . get_permalink() . '">' . __( "Read more", 'uplift' ) . '</a>'; } $recent_post .= '</div>'; } $recent_post .= '</div>'; return $recent_post; }
Now edit the this code :-
$post_date_str = get_the_date('Y-m-d');
Thanks
Mohammad -
Posted in: Uplift
You must be logged in and have valid license to reply to this topic.