• Resolved nflowers1228

    (@nflowers1228)


    I have made quite a bit of progress updating the meeting list page, however, when I try to add columns, the Table Head shows up but not the column with data.

    http://www.ceahow.org/wp/meetings/

    I’m trying to add the state as a separate TH but that didn’t work although when I added the code below, the city and state show up in the same column. Also Contact info is not showing up in a separate column. What am I missing?

    <td class=”state” data-sort=”<?php echo sanitize_title($meeting[‘state’]) . ‘-‘ . $sort_time?>”>
    <?php echo $meeting[‘state’]?>
    </td>

    • This topic was modified 9 years, 7 months ago by nflowers1228.
Viewing 1 replies (of 1 total)
  • Actually as of 2.5.3, state is no longer a field in the database. We’re just storing the formatted address, eg 123 Main Street, Anytown, OK 12345, USA. Having it broken up into a bunch of individual fields on the backend creates a more burdensome system, and doesn’t help with international addresses. Plus the new way is faster on many systems.

    If I were you in this situation, I’d write a custom function to parse the state from the formatted address. Here’s one of the top of my head that I haven’t tested at all:

    
    function format_state($address) {
      $parts = explode(' ', $address);
      $count = count($parts);
      if (($parts[$count-1] == 'USA') && (strlen($parts[$count-3]) == 2)) {
        return $parts[$count-3];
      }
      return '';
    }
    

    Then in your table:

    <?php echo format_state($meeting['formatted_address'])?>

    Good luck!

Viewing 1 replies (of 1 total)

The topic ‘Help adding columns’ is closed to new replies.