• Resolved daelemans_m

    (@daelemans_m)


    Hello

    Is there a way to get a field without spaces and characters (colons, commas, …)? I want to use the field in my CSS.

    Example: the field content is “10:00 – 18:00” and I want to get it as “1000-1800”.

    Thanks!

    Matthias

Viewing 1 replies (of 1 total)
  • Thread Starter daelemans_m

    (@daelemans_m)

    I found a code which works partially:

    <?php $a = array(':',' - '); $b = array('',''); $str = '10:00 - 18:00'; echo str_replace($a, $b, $str); ?>

    That code displays 10001800.

    But I have to do this multiple times with different hours (see $str) and I don’t want to change the $str each time. When I replace the '10:00 - 18:00'; with the_field("dag-2"); (which equals to 10:00 – 18:00), it displays the field but it replaces nothing.

    Someone please? ??

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Advanced Custom Fields] Get field without spaces and characters’ is closed to new replies.