-
AuthorPosts
-
July 22, 2024 at 8:07 am #1462643
Hi,
I am trying to use the {wp_post_ID} tag to dynamically add a Post ID in my button label/button custom link,however the Post ID doesn’t seem to be parsed to an (int). For example, a post ID of 10000 is returned as 10,000. *I believe the IDs should be returned without a comma.
Kindly advise if you have a temporary fix for this I can implement, before you review it for update in one of the future updates.
Screenshot for reference: https://snipboard.io/wMUOI5.jpg
Thank you.July 22, 2024 at 8:39 am #1462651Hey Rustum,
Thank you for the inquiry.
Please note that the dynamic content feature is limited to fields with the orange database icon beside them. It will not work with the Custom ID Attribute or Custom CSS Class fields. You will need to add the ID manually.
Best regards,
IsmaelJuly 23, 2024 at 9:35 am #1462748Hi Ismael,
Thanks for your reply.
I am aware of that. I think you may have understood my message and also missed the screenshot: https://snipboard.io/wMUOI5.jpg
I have added the dynamic content {wp_post_ID} to a button Label (which has the orange database icon). It returns the Post ID as 49,708. Instead of 49708.
Should the Post ID not be an int, without the thousand comma separator?
July 23, 2024 at 11:05 am #1462758Hi,
Sorry for the confusion. I misread your previous post. We’ll forward this thread to our channel. In the meantime, if you simply want to remove the comma from the button label, you can try this script in the functions.php file:
function ava_custom_script_here() { ?> <script> (function ($) { function g() { $('.avia-button .avia_iconbox_title').each(function() { var text = $(this).text().replace(/,/g, ''); $(this).text(text); }); } $(document).ready(function () { g(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script_here');
Best regards,
IsmaelJuly 24, 2024 at 7:54 am #1462825Thanks Ismael,
This works for now.
I will be looking forward to an update of the theme with the fix.July 24, 2024 at 10:02 am #1462833may i ask you just a question – what benefit has a button label with the ID – That’s not very meaningful for visitors. Perhaps I am overlooking the usefulness of such a button.
July 25, 2024 at 6:50 am #1462923Hi,
I will be looking forward to an update of the theme with the fix.
This is the intended behavior and the expected returned value, so it won’t be changed in the next patch. However, you can still adjust the returned value by using the avf_dynamic_format_output_data filter in the functions.php file instead of using the script above.
function avf_mod_dynamic_format_output_data($ret_val, $source_data, $atts, $source, $force_format) { $ret_val = str_replace(',', '', $ret_val); return $ret_val; } add_filter('avf_dynamic_format_output_data', 'avf_mod_dynamic_format_output_data', 10, 5);
Best regards,
IsmaelJuly 25, 2024 at 8:41 am #1462936Hi Guenni007
I am actually trying to use the {wp_post_ID} to get the post id (without commas for a dynamic link) e.g. https://kriesi.at/?iframe=true&post_id={wp_post_ID}So while I referred to the Button label, I am actually using this in the Custom Field Link section because {postID} doesn’t work there as per:
“Custom Field Link
Select a custom field containing a string – leave empty to use selectbox setting:an URL starting with http://, https:// (e.g. https://your-domain.com)
an E-Mail containing @, may start with “mailto:” (e.g. mailto: (Email address hidden if logged out) )
link to a post: “{post_type},{postID}” (e.g. post,1058)
link to a taxonomy: “{taxonomy_slug},{termID}” (e.g. category,8)”July 25, 2024 at 8:48 am #1462937Thanks Ismael !!, exactly what I needed. That filter works perfectly and I am able to get the Post ID dynamically now in the custom field link:
Example: https://kriesi.at/?iframe=true&post_id={wp_post_ID}
July 26, 2024 at 7:40 am #1463019 -
AuthorPosts
- The topic ‘Post ID Formatting on new Post Data feature on Button Element’ is closed to new replies.