• Resolved jwarren

    (@jwarren)


    WP-Tables Reloaded is very powerful, and I’ve found it very useful.

    However, it would be extremely advantageous if new lines within a td were wrapped in <p> tags to enable styling of elements inside the table. I realise that plain code can be pasted in, but this is rather inconvenient for obvious reasons.

    I’ve tried tweaking the plugin files to achieve this, but I’ve encountered nothing but ruin! I don’t think my PHP skills are quite at the level needed.

    So I’d be very grateful if you’d consider an option for this in the next version.

    Many thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the suggestion. Unfortunately, this could lead to several different problems, where you already mention one, with the usage of code in the cell.

    Also, I’m not quite sure, why you need the additional <p> tags in the table cells. Can you describe an example? Maybe we can find a different solution without the need for the <p>s.

    Regards,
    Tobias

    Thread Starter jwarren

    (@jwarren)

    Thanks for your quick response, Tobias.

    In this particular case, I’ve got a table being used as a timetable, with the x axis as days of the week, and the y axis as rough timeslots. Within each cell needs to sit three items. Let’s call them startingtime, subject (which may well wrap onto the next line), and teacher.

    Now, ideally there would be a decent amount of room between each of those three attributes. However, adjusting the line-height will push wrapped subject lines apart, as it should do. How I’d ideally do it, is put a bit of margin on the td ps, and a border-top and border-bottom on the td p:nth-child(2) for the non-IE users.

    Unfortunately, <br> is an non-stylable element, so unless I use some javascript to style it up, I’ve got no options.

    ——

    In a mostly unrelated feature request, another useful feature would be to be able to set a custom id and/or class for each table, simply to help in transferring CSS from static files.

    By the way, thank you so much for your time, Tobias. I and many others really appreciate the work that plugin authors like you do.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for that explanation. I guess it does make sense to have <p> tags in your case, without messing around with them in the textfields on the “Edit” screen of the table.

    Actually, there might be a possibility to get those <p> tags with a plugin filter hook. I just remembered that method, which I did not add to the plugin directly, as it is not too reliable (and can add heavier load on large tables).

    Please try adding this to your theme’s “functions.php”:

    add_filter( 'wp_table_reloaded_cell_content', 'wpautop' );

    I didn’t yet have the time to test this, but with that code, the text should be wrapped in paragraphs (however, this will apply to all tables then, not just single ones!).
    Can you please try that and tell us about the results?
    Thanks!

    About your feature request: There also is a plugin filter available for that, which allows you to add a CSS class to a table. Additionally, however, I’m planning to add a text field for it in the next release, to make things easier. (I had actually planned to make this feature even larger, with something like table templates, but unfortunately I’m pretty busy at the moment and only have time for such smaller things.)

    Regards,
    Tobias

    Thread Starter jwarren

    (@jwarren)

    In a word – awesome.

    That works perfectly. You just have to make sure there’s a blank line between your text, and we’re p‘d all the way! I had no idea that you could add filters onto plugins. Presumably the hooks have to be pre-programmed in. Very powerful stuff!

    Again, thank you so much. I really look forward to seeing the awesome things you do with Tables Reloaded.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the feedback! Good to know that this works!

    And yes, the plugin filter hooks have to be pre-programmed in by a plugin developer – just as they have to in the WordPress core.
    I also think that this is a very powerful concept, which allows extending plugins very easily, so I added quite a bunch of filter hooks into WP-Table Reloaded.

    Best wishes,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: WP-Table Reloaded] Feature Request – use p instead of br’ is closed to new replies.