Home Forums Front-end Issues Xav



  • Hi,

    I have a checkbox array that is being output with commas, but I’d like to change the commas to pipes.

    This is what I have:

    <?php if( get_field('work_categories') ): ?>
      <h2><?php the_field('work_categories'); ?></h2>
    <?php endif; ?>

    So instead of outputting “Value 1, Value 2, Value 3” I want it to output “Value 1 | Value 2 | Value 3”


  • the_field() echos the content, so you’ll need to use get_feild() and then format the value yourself.

      $value = get_field('work_categories');
      if ($value) {
        ?><h2><?php echo implode(' | ', $value); ?></h2><?php 
  • Perfect, thank you!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.