-
AuthorPosts
-
February 17, 2022 at 12:36 pm #1341120
Hi guys!
How i can to change date of post?
https://disk.yandex.ru/i/JOPaU4nrjyGWMQ
I dont need to show date of post creation. I need to show date of last post editing.
Thank you!February 17, 2022 at 5:41 pm #1341205Hi,
Thanks for contacting us!
– Please make sure you are using a child theme – https://kriesi.at/documentation/enfold/child-theme/
– Go to /enfold/config-templatebuilder/avia-shortcodes/magazine/magazine.php file via FTP and copy it
– Create a folder called “shortcodes” in your child theme and paste magazine.php file inside that folder.
– Open magazine.php file on your child theme and find following line
$time = get_the_time( get_option('date_format'), $entry->ID );
and change it to following
$time = get_the_modified_time( get_option('date_format'), $entry->ID );
– Add the code shared here – https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb into functions.php file of your child theme :)Regards,
YigitFebruary 17, 2022 at 7:47 pm #1341229Yes! It works! Thank you!
But i see one more place, where posts still sowing ordered by creation date. https://disk.yandex.ru/i/hyOIpP8FtqioKQ ← main page – see privat field
This is Blog Posts element of Advaced Editor. I used your trick for customizing order for this element by this code:if(!function_exists('avia_custom_query_extension')) { function avia_custom_query_extension($query, $params) { global $avia_config; if(!empty($avia_config['avia_custom_query_options']['order'])) { $query['order'] = $avia_config['avia_custom_query_options']['order']; } if(!empty($avia_config['avia_custom_query_options']['orderby'])) { $query['orderby'] = $avia_config['avia_custom_query_options']['orderby']; } unset($avia_config['avia_custom_query_options']); return $query; } add_filter('avia_masonry_entries_query', 'avia_custom_query_extension', 10, 2); add_filter('avia_post_grid_query', 'avia_custom_query_extension', 10, 2); add_filter('avia_post_slide_query', 'avia_custom_query_extension', 10, 2); add_filter('avia_blog_post_query', 'avia_custom_query_extension', 10, 2); add_filter('avf_magazine_entries_query', 'avia_custom_query_extension', 10, 2); add_filter('avf_template_builder_shortcode_elements','avia_custom_query_options', 10, 1); function avia_custom_query_options($elements) { $allowed_elements = array('av_blog','av_masonry_entries','av_postslider','av_portfolio','av_magazine'); if(isset($_POST['params']['allowed']) && in_array($_POST['params']['allowed'], $allowed_elements)) { $elements[] = array( "name" => __("Custom Query Orderby",'avia_framework' ), "desc" => __("Set a custom query orderby value",'avia_framework' ), "id" => "orderby", "type" => "select", "std" => "", "subtype" => array( __('Default Order', 'avia_framework' ) =>'', __('Title', 'avia_framework' ) =>'title', __('Random', 'avia_framework' ) =>'rand', __('Date', 'avia_framework' ) =>'date', __('Author', 'avia_framework' ) =>'author', __('Name (Post Slug)', 'avia_framework' ) =>'name', __('Modified', 'avia_framework' ) =>'modified', __('Comment Count', 'avia_framework' ) =>'comment_count', __('Page Order', 'avia_framework' ) =>'menu_order') ); $elements[] = array( "name" => __("Custom Query Order",'avia_framework' ), "desc" => __("Set a custom query order",'avia_framework' ), "id" => "order", "type" => "select", "std" => "", "subtype" => array( __('Default Order', 'avia_framework' ) =>'', __('Ascending Order', 'avia_framework' ) =>'ASC', __('Descending Order', 'avia_framework' ) =>'DESC')); } return $elements; } add_filter('avf_template_builder_shortcode_meta', 'avia_custom_query_add_query_params_to_config', 10, 4); function avia_custom_query_add_query_params_to_config($meta, $atts, $content, $shortcodename) { global $avia_config; if(empty($avia_config['avia_custom_query_options'])) $avia_config['avia_custom_query_options'] = array(); if(!empty($atts['order'])) { $avia_config['avia_custom_query_options']['order'] = $atts['order']; } if(!empty($atts['orderby'])) { $avia_config['avia_custom_query_options']['orderby'] = $atts['orderby']; } return $meta; } }
//.
But looks like it not work properly. If I using order_by Modified it sowing posts from 2020 max, but with order_by Default showing posts from 2021.
Is it possible to make same changes for Blog Posts as we made for Magazine?p.s. I try to find same string in /enfold/config-templatebuilder/avia-shortcodes/BLOG/blog.php but i cant.
February 21, 2022 at 3:18 pm #1341665Hi,
Please copy /enfold/config-templatebuilder/avia-shortcodes/postslider/postslider.php to your child theme and then find following line
$meta_content .= "<time class='slide-meta-time updated' {$markup}>" . get_the_time( get_option( 'date_format' ), $the_id ) . '</time>';
and change it to following
$meta_content .= "<time class='slide-meta-time updated' {$markup}>" . get_the_modified_time( get_option( 'date_format' ), $the_id ) . '</time>';
Best regards,
YigitFebruary 22, 2022 at 6:58 pm #1341826Need assistence. I havn`t this code in this file.
You write i need to find
$meta_content .= "<time class='slide-meta-time updated' {$markup}>" . get_the_time( get_option( 'date_format' ), $the_id ) . '</time>';
But in my file is:
$meta .= "<time class='slide-meta-time updated' $markup>" . get_the_time( get_option( 'date_format' ), $the_id ) . '</time>';
Should I replace $meta with $meta_content or keep $meta ? And replace $markup with {$markup} or keep $markup ?- This reply was modified 2 years, 8 months ago by mischael1.
February 22, 2022 at 7:20 pm #1341832Hi,
You are currently using an older version of Enfold. Could you please update the theme firstly and then modify the file? I double checked and the line is in postslider.php file :)
Best regards,
YigitFebruary 23, 2022 at 12:52 am #1341881yes, you are right! updated to 4.9, correct code.
one more thing: I copied postslider.php file to \wp-content\themes\enfold-child\shortcodes\. Is it correct?February 23, 2022 at 12:07 pm #1341978 -
AuthorPosts
- You must be logged in to reply to this topic.