0

I am trying to execute a shortcode inside a function but I think I am missing some " or ' somehow because I get the error "Syntax error, unexpected T_String, expecting ']'"

Below is the function code, where is the problem?

    private function buttons( $id, $name, $link ) {

        return
            '<div class="review-table-extended--buttons text-center">

                <a class="button ' . Akurai_Shortcodes::$button_animation . '"
                    href="' . esc_url( $link ) . '" ' . Akurai_Vars::$link_attributes . '>'
                    . str_replace( '%s', $name, Akurai_Shortcodes::$button_text ) . '
                </a>

                <a class="inline-block mt-4" href="' . get_permalink( $id ) . '">'
                    . str_replace( '%s', $name, Akurai_Shortcodes::$review_text ) . '
                </a>

                ' . $this->terms( $id ) . '
            
        <p class="geolock"><span><?php echo do_shortcode( '[geoip_detect2_hide_if country="' . $ai_countries_restricted . '"]🟢 Casino is [geoip_detect2 property="extra.flag"][geoip_detect2 property="country.name"] friendly ✅[/geoip_detect2_hide_if]
[geoip_detect2_show_if country="' . $ai_countries_restricted . '"]🛑 Casino is <strong>not</strong> [geoip_detect2 property="extra.flag"][geoip_detect2 property="country.name"] friendly 🚫[/geoip_detect2_show_if]' ); ?></span></p>
            
            </div>
            ';
        
    }

This is the shortcode I am trying to execute:

    <p class="geolock"><span><?php echo do_shortcode( '[geoip_detect2_hide_if country="' . $ai_countries_restricted . '"]🟢 Casino is [geoip_detect2 property="extra.flag"][geoip_detect2 property="country.name"] friendly ✅[/geoip_detect2_hide_if]
[geoip_detect2_show_if country="' . $ai_countries_restricted . '"]🛑 Casino is <strong>not</strong> [geoip_detect2 property="extra.flag"][geoip_detect2 property="country.name"] friendly 🚫[/geoip_detect2_show_if]' ); ?></span></p>
aynber
  • 20,647
  • 8
  • 49
  • 57

0 Answers0