Support » Plugin: Contact Form DB » CFDB – Display Images in [cfdb-datatable]

  • Hello
    I just wanted to ask if the following script worked for anyone:
    Display Images in [cfdb-datatable]:

    The two scripts “make links or email clickable in tables” work fine with me:

    Thanks in advance.
    Stefan

Viewing 3 replies - 1 through 3 (of 3 total)
  • mrmut

    (@mrmut)

    It worked for me. Add this script to functions.php bottom and add table normally as you would, just give it an ID #imageshow

    function image_show_cfdb(){ ?>
    
    <script type="text/javascript" language="Javascript">
    (function($) {
        $(document).ready(function() {
            $("#imageshow td[title='image'] > div > a").each(function() {
                var href = $(this).attr('href');
                var label = $(this).html();
                var imgTag = '<a href="' + href + '" target="_blank"><img height="100" width="100" src="' + href + '" alt="' + label + '" ></a>';
                $(this).parent().html(imgTag);
            })
        });
    })(jQuery);
    </script>
    
    <?php } 
    
    add_action('wp_footer', 'image_show_cfdb');
    mrmut

    (@mrmut)

    (Script doesn’t work if added as part of the shortcode.)

    snormal

    (@snormal)

    I copied the code into function.php of my theme and added the id in the shortcode as follows:

    [cfdb-datatable form="Kontaktformular" id="#imageshow"...]

    But it doesn’t work.

    • This reply was modified 3 months ago by snormal.
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.