Passing parameter to do_shortcode

Home Forums MapPress Support Passing parameter to do_shortcode

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22029
    katen
    Participant

      I have this in a template:

      $mapid = get_field( ‘map_id’, get_the_id());

      if ($mapid){
      echo do_shortcode(‘[[mappress mapid="'.$mapid.'"]]‘);
      }

      It is not outputting the map, it outputs the shortcode itself on the page:

      [mappress mapid="315"]

      What am I doing wrong here?

      #22030
      Chris
      Keymaster

        Hi,

        I think when you use double braces for a shortcode, WordPress just outputs it as a string.

        Try with just one brace:

        echo do_shortcode(‘[mappress mapid="'.$mapid.'"]‘);

         

         

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.