• Resolved danseurs.visages

    (@danseursvisages)


    Hello,
    first sorry for my bad english πŸ˜‰

    I’m using a plugin (wowhead tooltips) which parse a post to replace [item]12345[/item] by an URL. To do that, i have insert javascript in the worpress header.php. But it doesn’t work for cells’ table. It seems that the plugins parse the post before wp_table insert the html code of a table.

    One solution is to insert this javascript in wp_table. Is it possible ?

    An other is to try to parse the post after wp_table insert his html => i will post to wowhead tooltips site to know if it is possible.

    Last is to insert directly the URL in cell. It’s working but need some more work for me πŸ™‚

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post.

    Yes, you can execute JavaScript in table cells. You will however need to put everything in one line, so there can not be any manual line breaks in the code (only those that automatically come from the browser, due to the width of the textfields).

    Regards,
    Tobias

    Thread Starter danseurs.visages

    (@danseursvisages)

    Sorry, my question is not enough accurate ^^

    Actually i insert this 3 lines in the header.php of my theme but they don’t parse cells’ table :
    <link href=”./wowhead/css/wowheadtooltips.css” rel=”stylesheet” type=”text/css” />
    <script src=”http://static.wowhead.com/widgets/power.js”></script&gt;
    <script src=”./wowhead/js/armory.js.php” type=”text/javascript”></script>

    I want to do the same thing so the javascript will be execute in the wp-table. Is there a wp-table header where i can insert this ?

    In other words, how to parse data in wp_table using the javascript declare in my header.php ?

    Hope you will understand what i mean πŸ™‚

    Tanks for your patience.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    the JavaScript parsing is done after the page is completely generated, so it does not really matter where the content comes from.

    The actual problem might be that the bbCodes are interpreted as Shortcodes by WordPress and therefore removed.

    Can you please post a link to the page with your table?

    Regards,
    Tobias

    Thread Starter danseurs.visages

    (@danseursvisages)

    Hello,
    if the parsing it done after, i think it’s the other plugin which fail. I will investigate this evening.

    here en example : http://www.slc.fistandantilus.com/vvcc/wp/66

    The page code is :
    [item]62406[/item]
    [table id=16 /]

    in table 16, i have [item]62406[/item]

    Outside of the table, [item]62406[/item] is convert to [Gants de fièvre des os]
    Inside the table [item]62406[/item] is not convert.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ok, thanks for the link. As it seems, the replacing is indeed already done in PHP (then the JavaScript is only used to render the tooltip).

    I checked the source code of the plugin and the plugin does not use the default WordPress Shortcode API, but a custom implementation. This can however be fixed, so that the replacing also works in tables.

    Please add this code to the “functions.php” file in your theme folder:

    add_filter("wp_table_reloaded_cell_content", "whp_parse");

    Regards,
    Tobias

    Thread Starter danseurs.visages

    (@danseursvisages)

    Hello,
    it work nice. Tanks a lot πŸ™‚

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Execute javascript in table’ is closed to new replies.