-
AuthorPosts
-
December 5, 2019 at 10:07 am #1162851
Hello. On my site I have defined an Enfold Child Latest News widget, which is set to display several posts from a specific category (screenshot). On one of my pages (my “Knowledge Hub” page), using the Avia Page Builder, I have inserted a ‘Widget Area’ element, and have set it to display the widget I created. The front-end of the page then displays a list of posts. But each entry in the list displays a title and a timestamp (screenshot). In a previous ticket I was given custom PHP code to hide the time stamps. When I added the code, the time stamps on this page were indeed removed, as desired (screenshot). But the code caused a new issue. On my blog posts, there is a sidebar which displays a list of ‘recent posts.’ Before adding your code, this section looked like this. As you can see, under each post title is a date and time. This is desired. But after I add your code, that changes to this. As you can see, the easy-to-read time stamp has changed to an undesirable string. I would like this text to remain unchanged. How can I do so?
One major issue I am experiencing is that in my PHP code, I have already ensured the custom code is executed *only* on my Knowledge Hub page. So I’m not sure why the code is affecting blog posts like this. Here is my code:
function change_avia_date_format( $date, $time_format ) { $fxl_kh = get_page_by_title( 'Knowledge Hub' );// Obtain the Knowledge Hub page object. if ( $fxl_kh ) { $fxl_kh_id = $fxl_kh->ID;// Obtain the Knowledge Hub ID. $fxl_curr_page = get_queried_object();// Obtain the current page object. if ( $fxl_curr_page ) { $fxl_curr_page_id = $fxl_curr_page->ID;// Obtain the current page ID. if ( $fxl_kh_id === $fxl_curr_page_id ) {// If the current page ID matches the Knowledge Hub ID, modify $time_format accordingly. error_log( print_r( 'testy message', true ) ); $time_format = false;// Set $time_format to false to ensure date does not render. } } } return $time_format; } add_filter( 'avia_widget_time', 'change_avia_date_format', 10, 2 );
If you need to pass this up to a developer, please do so.
Thanks.
December 9, 2019 at 8:41 pm #1164174Hey FeedXL2019,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisDecember 10, 2019 at 6:00 am #1164319Thanks for the reply. I’m a developer, and comfortable adding custom PHP code to my site.
>> Unfortunately, it would require quite some time and customization of the theme to achieve this,
I’m not sure what you are referencing here. For clarity, let me perhaps re-phrase my question, with simplified code. I have added the following custom PHP function to my site and attached it to Enfold’s
avia_widget_time
hook:function change_avia_date_format( $date, $time_format ) { if ( 517 === get_queried_object()->ID ) { $time_format = false; } return $time_format; } add_filter( 'avia_widget_time', 'change_avia_date_format', 10, 2 );
Will this function set
$time_format
tofalse
on all pages, or just on the page with post ID = 517?Thanks.
- This reply was modified 4 years, 11 months ago by FeedXL2019.
December 11, 2019 at 10:04 pm #1165002Hi,
I think u need to change the get_queried_object()->ID wit hthe page ID to work for what you need..
Best regards,
BasilisDecember 12, 2019 at 7:54 am #1165105Hi Basilis,
It would help me greatly if you could answer the question I asked in my previous message. To reiterate, would you expect that PHP code to set $time_format to false on all pages, set $time_format to false on just on the page with post ID = 517, or something else?
If you need to pass this question up to a developer, that would be fine.
Thanks.
December 14, 2019 at 3:54 pm #1165880Hi,
The avia_widget_time filter is called in an additional loop, which modifies the main WP query.
The only chance to get the page ID is to hook into the avf_newsbox_image_size filter, get the page ID there and store it in a global variable which you can access in the avia_widget_time filter later.
Hope this helps you.
Best regards,
GünterDecember 19, 2019 at 1:11 pm #1167707OK thanks for that. In light of all this new information, I’ll go with a CSS-only workaround.
In the future, when I open a ticket here, is there any way to immediately speak with a developer? No offense to the people that respond, but often times they don’t understand my question, or don’t know how to resolve it. It then takes several days or weeks before an actual developer can reply to the thread.
It would save a lot of time if I could immediately speak with that person.December 29, 2019 at 10:14 am #1169060Hi,
Glad the CSS workaround will work for you!
If you like to speak directly to any one person you can mention that in the private content area for our admins to look at and if the person is available we will forward your request. We are a global team and we all work at different times and if the person is on leave then your request time may be longer so we try to help you.
To get your issue resolved fast please make sure it is within our support scope. Most of the time we try to help all our customers even if their issue is out of our support scope and sometimes this takes more time as well. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Thank you for your understanding :)
Best regards,
VinayFebruary 3, 2020 at 11:51 am #1180848>> If you like to speak directly to any one person you can mention that in the private content area for our admins to look at and if the person is available we will forward your request.
OK thanks for that. Sometimes my request is a little above what first level support can handle, so I’d prefer to go directly to a dev if possible. What’s frustrating is when a non-dev tries to answer my question, and does so incorrectly or insufficiently. It wastes his time and mine when that occurs.
>> We are a global team and we all work at different times and if the person is on leave then your request time may be longer so we try to help you.
Understood, and that’s OK.
>> To get your issue resolved fast please make sure it is within our support scope. Most of the time we try to help all our customers even if their issue is out of our support scope and sometimes this takes more time as well.
Yes, I understand, and will strive to do so.
>> However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
My company has indeed hired a freelancer to do these jobs. *I’m* that freelancer :-) In a previous ticket, I was given specific code by Enfold support to achieve something, but it did not work as promised. So in this ticket I returned to ask why. Gunter was finally able to clearly answer my question.
Thanks again for the help.
February 7, 2020 at 8:05 pm #1182388Hi,
Thank you for the feedback.
Remember we do not always provide code, this depends if we have done it previously or not for the same topic or if iti s something quick.Thank you
Best regards,
Basilis -
AuthorPosts
- The topic ‘Issue with time stamps’ is closed to new replies.