Title: shortcode usage in HTML tables
Last modified: August 21, 2016

---

# shortcode usage in HTML tables

 *  Resolved [rkahana](https://wordpress.org/support/users/rkahana/)
 * (@rkahana)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/)
 * Hello,
 * Plugin works well but when trying to use it to control content within an HTML
   table weird things happen.
 * I’m trying to do the following:
 *     ```
       <table class="input-parameters">
       <tbody>
       <tr>
       <td>Resource</td>
       <td>Description</td>
       </tr>
       [eyesonly logged="in" pp_group="12"]
       <tr>
       <td><b><a some link>some link</a></b></td>
       <td>blah blah blah</td>
       </tr>
       [/eyesonly]
       </tbody>
       </table>
       ```
   
 * When switching between the text and visual editors, the shortcode gets taken 
   out of the table and placed before the table itself resulting in:
 *     ```
       [eyesonly logged="in" pp_group="12"][/eyesonly]
       <table class="input-parameters">
       ```
   
 * Any ideas?
 * [https://wordpress.org/plugins/eyes-only-user-access-shortcode/](https://wordpress.org/plugins/eyes-only-user-access-shortcode/)

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

 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573390)
 * Hi. First of all, you don’t need “logged=in” if you’re using pp_group=”12″ or
   the level=”whatever” attributes. Only those specified in pp_group= or level= 
   will be able to see the content, so logged out users are excluded as well. Just
   for the record.
 * HTML doesn’t allow you to put code in between table-row tags like that, which
   is why WordPress is moving the eyesonly shortcode out of the table. It knows 
   it doesn’t belong where you’re putting it. Here’s what you can do. Put the shortcodes
   inside the TD tags and do one shortcode to show to your PP group, and one shortcode
   to hide content from that same PP group:
 *     ```
       <table>
       <tr>
       <td>[eyesonly pp_group="12"]Content for Group 12[/eyesonly][eyesonly pp_group="12" hide="yes"]Content for everyone else.[/eyesonly]</td>
       <td>[eyesonly pp_group="12"]Content for Group 12[/eyesonly][eyesonly pp_group="12" hide="yes"]Content for everyone else.[/eyesonly]</td>
       </tr>
       </table>
       ```
   
 * That will work fine.
 *  Thread Starter [rkahana](https://wordpress.org/support/users/rkahana/)
 * (@rkahana)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573393)
 * Thanks for the prompt reply!
 * I understand your solution but I’m trying to avoid presenting empty rows/cells
   in a table with multiple rows.
 * If I have a table with 20 potential rows and wish to display only rows 5 10 and
   13 to a certain group, I would preferably like to present a table with only 3
   rows instead of a 20 row table with 17 redacted rows.
 * Do you have any creative workaround for that?
 * Thanks again for the quick engagement.
 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573395)
 * Well, depending on how sensitive the info is in the table-row that you’re restricting,
   CSS may or may not be a solution for you. But you can apply two classes to the
   TR element and then follow up your HTML with some inline styles, where one of
   the two classes is defined inside eyesonly tags, like this:
 *     ```
       <table>
       <tbody>
       <tr class="hide-default ppgroup-twelve-show">
       <td>Stuff only for PP Group 12</td>
       </tr>
   
       <tr>
       <td>Stuff for everyone</td>
       </tr>
       </tbody>
       </table>
   
       <style><!--
       .hide-default {display:none;}
       [eyesonly pp_group="12"]
       .ppgroup-twelve-show {display:inherit!important;}
       [/eyesonly]
       --></style>
       ```
   
 *  Thread Starter [rkahana](https://wordpress.org/support/users/rkahana/)
 * (@rkahana)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573398)
 * Nice solution!
 * Thanks again.
 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573399)
 * Alternatively, you can just create two completely different tables, and hide 
   one of them from pp_group 12 and show the other one only to pp_group 12. It’s
   a bit clunkier, but it’s really just copy/paste work.
 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573400)
 * No worries. Let me know if you need any further help.

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

The topic ‘shortcode usage in HTML tables’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/eyes-only-user-access-shortcode_f1f0ef.
   svg)
 * [Eyes Only: User Access Shortcode](https://wordpress.org/plugins/eyes-only-user-access-shortcode/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eyes-only-user-access-shortcode/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [thomstark](https://wordpress.org/support/users/thomstark/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/shortcode-usage-in-html-tables/#post-4573400)
 * Status: resolved