WordPress.org

Ready to get started?Download WordPress

Forums

Query Wrangler
[resolved] How do I add column header content? (th tag) (3 posts)

  1. madai
    Member
    Posted 1 year ago #

    Hi,

    Please help me with this, I really need to name my columns in the table. I can see that the th tags are there but they are empty and I can't figure out how to populate them with some content.

    Thanks in advance

    Zoltan

    http://wordpress.org/extend/plugins/query-wrangler/

  2. Jonathan Daggerhart
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry for the late reply.

    Use the 'Create Label' checkbox and text input beneath it for a table header for that field.

  3. Tubia
    Member
    Posted 1 year ago #

    Hi,
    I understand that time passed since the last reply, but I think my experience with tables could add something to the discussion.
    When we add labels to fields and then select the "table" style, it appears the table with the correct thead and th, but labels are displayed also in each field...
    I dig into the structure of the style and that's it:

    <table class="query-table query-<?php print $slug; ?>" cellpadding="0" cellspacing="0" border="0">
      <thead class="query-table-head">
        <?php foreach($rows[0]['fields'] as $field): ?>
          <th><?php print $field['label']; ?></th>
        <?php endforeach; ?>
      </thead>
      <tbody class="query-table-body">
        <?php foreach($rows as $row): ?>
          <tr class="<?php print $row['row_classes']; ?>">
    
            <?php foreach($row['fields'] as $field): ?>
              <?php if(isset($field['output'])): ?>
                <td class="<?php print $field['classes']; ?>">
                  <?php print $field['output']; ?>
                </td>
              <?php endif; ?>
            <?php endforeach; ?>
    
          </tr>
        <?php endforeach; ?>
      </tbody>
    </table>

    So it seems that $field is an array that has 'label', 'classes', and 'output', and the last one contains the field's output and the label if is set. Maybe if it would be possible to output only the content of the field without the label... but I think we have to edit the $field array.

    What do you think? Suggestions?

    Thank you in advance! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic