diff --git a/CleanBuild/functions/acf/acf-shortcodes.php b/CleanBuild/functions/acf/acf-shortcodes.php index 76c06dc..e31bc52 100644 --- a/CleanBuild/functions/acf/acf-shortcodes.php +++ b/CleanBuild/functions/acf/acf-shortcodes.php @@ -16,17 +16,17 @@ function company_reg_func( $atts ){ // COMPANY OPENING HOURS SHORTCODE function company_opening_hours_func( $atts ){ $a = shortcode_atts( array( - 'container' => 'false', + 'container' => false, ), $atts ); $container = esc_attr($a['container']); $html = ''; - if($container == 'true') { + if($container === true) { $html .= '
'; } while ( have_rows('company_opening_hours','company') ) : the_row(); $html .= '

'. get_sub_field('time') .'

'; endwhile; - if($container == 'true') { + if($container === true) { $html .= '
'; } @@ -38,9 +38,9 @@ function company_opening_hours_func( $atts ){ // EMAIL ADDRESS SHORTCODE function company_email_address_func( $atts ){ $a = shortcode_atts( array( - 'link' => 'false', + 'link' => false, 'row' => '1', - 'quick-link' => 'false', + 'quick-link' => false, ), $atts ); $link = esc_attr($a['link']); @@ -55,10 +55,10 @@ function company_email_address_func( $atts ){ $email = antispambot(get_sub_field('email_address'), 0); if($row == $counter) { - if($quick == 'true') { + if($quick === true) { $html .= ''. $email .''; } else { - if ($link == 'true'){ + if ($link === true){ $html .= 'mailto:' . $email . '?subject='. $company .' (Website enquiry)'; } else { $html .= $email; @@ -75,9 +75,9 @@ function company_email_address_func( $atts ){ // PHONE NUMBER SHORTCODE function company_phone_number_func( $atts ){ $a = shortcode_atts( array( - 'link' => 'false', + 'link' => false, 'row' => '1', - 'quick-link' => 'false', + 'quick-link' => false, ), $atts ); $link = esc_attr($a['link']); @@ -100,10 +100,10 @@ function company_phone_number_func( $atts ){ } if($row == $counter) { - if($quick == 'true') { + if($quick === true) { $html .= ''. $number .''; } else { - if ($link == 'true'){ + if ($link === true){ $html .= 'tel:' . $number_link; } else { $html .= $number; @@ -114,7 +114,7 @@ function company_phone_number_func( $atts ){ return $html; - if ($link == 'true'){ + if ($link === true){ return $number_link; } else { return $number; @@ -134,30 +134,52 @@ function company_fax_number_func( $atts ){ function company_address_func( $atts ){ $a = shortcode_atts( array( 'row' => '1', - 'include-name' => 'false', - 'container' => 'false', + 'include-name' => false, + 'container' => true, + 'list' => true, + 'line-break' => false, ), $atts ); $row = esc_attr($a['row']); $name = esc_attr($a['include-name']); $container = esc_attr($a['container']); + $list = esc_attr($a['list']); + $linebreak = esc_attr($a['line-break'); $counter = 0; $html = ''; - if($container == 'true') { + if($container === true) { $html .= ''; } @@ -170,11 +192,11 @@ function company_address_func( $atts ){ // SOCIAL LINKS SHORTCODE function company_social_func( $atts ){ $a = shortcode_atts( array( - 'container' => 'false', + 'container' => false, ), $atts ); $container = esc_attr($a['container']); $html = ''; - if($container == 'true') { + if($container === true) { $html .= ''; } diff --git a/README.md b/README.md index 21d75d0..0db4599 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ __Shortcodes__ - [Company Opening Hours](#company-opening-hours) ### Company Address -Returns the __Company Address__ field. It returns each row in to a separate ```li``` tag. +Returns the __Company Address__ field. By default it returns each row in to a separate ```li``` tag surrounded by a ```ul``` with the class of ```address-list```. ```php ``` @@ -44,7 +44,9 @@ Option | Type | Default | Description --- | --- | --- | --- row | int | 1 | Selects which repeater row phone number will be returned include-name | boolean | false | Will return the company name as the first ``` li ``` -container | boolean | false | Will wrap the returned list items in a ```ul``` with the class of ```address-list``` +container | boolean | true | Wraps the returned list items in a ```ul``` with the class of ```address-list``` +list | boolean | true | Wraps each list item in a ```li``` tag +line-break | boolean | false | Will add a ```br /``` tag after the list item (applies when list option is false) ### Company Email Address Returns the __Company Email Address__ field in plaintext.