Title: Layout help
Last modified: August 22, 2016

---

# Layout help

 *  [pluggy](https://wordpress.org/support/users/pluggy/)
 * (@pluggy)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/)
 * Hi, great plugin, great documentation and great support, well done! I need a 
   little help with layout please. I’m trying to build textfields such as those 
   displayed by `<?php $this->field->print_element(); ?>` but displayed in a table.
 * like this:
 *     ```
       <td><?php $weekly->print_element('this_field') ?></td>
       <td><?php $weekly->print_element('that_field') ?></td>
       ```
   
 * The intention is to have a form that will display all the data that the user 
   can go and add to each day of the week simply by clicking in the relevant textfield,
   updating the info and clicking save. It needs to be displayed in a table, not
   one above the other as in the standard record loop.
 * Thanks! Cup a coffee coming your way.
 * [https://wordpress.org/plugins/participants-database/](https://wordpress.org/plugins/participants-database/)

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

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633612)
 * OK, well there are probably several ways to do this, but I don’t have enough 
   info to get too detailed.
 * Most importantly, if you’re going to set up a form in a table, you need to decide
   what constitutes a row or column. It’s not clear to me what you’re looking for
   there.
 * You can do this yourself, using [custom templates](http://xnau.com/work/wordpress-plugins/participants-database/pdb-templates/),
   but you will need a solid understanding of HTML and some PHP. You would create
   a custom template, then change how the looping works to lay out your table. I
   imagine you could use grouping to help with the layout: each group could be one
   of your columns, for instance.
 *  Thread Starter [pluggy](https://wordpress.org/support/users/pluggy/)
 * (@pluggy)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633625)
 * Thanks for your reply. I have managed to get this far by experimenting. I have
   created a template and put the <th> and <tr> outside the loop to get each group
   as a table row with each field as <td>. For the dummies (me), how would I modify`
   while ($this->have_groups()) : $this->the_group();` to choose a group of groups
   to include (or exclude others)? I see you have built in an exclude for fields
   but I can’t see one for groups. I would like to have separate templates for user
   details and this form.
 * The other way I could build the table would be if there is a way to reference
   each individual field by name, such as:
 *     ```
       <tr>
           <th scope="row">Carbs</th>
           <td><?php $weekly->print_field('monc') ?></td>
           <td><?php $weekly->print_field('tuec') ?></td>
           <td><?php $weekly->print_field('wedc') ?></td>
           <td><?php $weekly->print_field('thuc') ?></td>
           <td><?php $weekly->print_field('fric') ?></td>
           <td><?php $weekly->print_field('satc') ?></td>
           <td><?php $weekly->print_field('sunc') ?></td>
           <td></td>
         </tr>
       ```
   
 * Except instead of just displaying the result, using something like `$weekly->
   print_element` to show the textfield so each field can be edited.
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633645)
 * You can set which groups are included in the form by using the “groups” attribute
   in the shortcode and naming the groups you want to appear.
 *  Thread Starter [pluggy](https://wordpress.org/support/users/pluggy/)
 * (@pluggy)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633647)
 * That works but can I select the group per loop `($this->have_groups()) : $this-
   >the_group();` so I can format each differently? I tried `<?php echo do_shortcode('[
   pdb_single template=loop groups=measurements]'); ?>` but I get a “No record was
   found” error.
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633656)
 * You have to do it with a conditional statement like you would for a field.
 *     ```
       <?php if ($this->group->name === 'measurements' ) : ?>
       ```
   
 * It’s trickier because you have to include the fields loop in the code chosen 
   by the condition.
 * Another approach is to use a pure CSS solution, targeting the group by it’s class
   name.
 * The “do_shortcode” won’t work unless the ID is in the URL or you tell it which
   record to show:
 * `<?php echo do_shortcode('[pdb_single template=loop groups=measurements record_id
   =22]'); ?>`

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

The topic ‘Layout help’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Roland Barker](https://wordpress.org/support/users/xnau/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/layout-help-11/#post-5633656)
 * Status: not resolved