Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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.

    #1462651

    Hey 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,
    Ismael

    #1462748

    Hi 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?

    #1462758

    Hi,

    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,
    Ismael

    #1462825

    Thanks Ismael,
    This works for now.
    I will be looking forward to an update of the theme with the fix.

    #1462833

    may 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.

    #1462923

    Hi,

    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,
    Ismael

    #1462936

    Hi 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)”

    #1462937

    Thanks 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}

    #1463019

    Hi,

    Great! Glad to know that the filter worked. Please feel free to open another thread if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Post ID Formatting on new Post Data feature on Button Element’ is closed to new replies.