Mashup Template PHP Syntax

Home Forums MapPress Support Mashup Template PHP Syntax

Tagged: , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13317
    dan1
    Participant

    I’ve been digging through the documentation and forum but I can’t find anything explaining how to use php to display a mashup query in a template. Besides using the combination of php and shortcodes.

    The goal is to dynamically generate a mashup map of dealerships (custom post type) by state (category).

    Example: If I want to show all dealerships in Florida, this combination of php and shortcode, added to a template works perfectly.

    
    echo do_shortcode
    ('
     [mashup query=
       "dealership_state=florida&
       posts_per_page=-1"
     ]
    ');
    

    Is there a way to show Arizona, California, or another state without creating indivual static pages?

    Assuming I’ve found the current state (category) with something like:

    
    $current_dealership_state=
    strip_tags(
      get_the_term_list( 
        $post->ID, 'dealership_state'
      )
    );
    

    Is there a way to php code this into a template replacing florida with $current_dealership_state?

    #13318
    Chris
    Keymaster

    Hi,

    You just need to include your variable(s) in the query:

    echo do_shortcode
    ('
     [mashup query=
       "dealership_state=' . $current_dealership_state . '&
       posts_per_page=-1"
     ]
    ');
    #13321
    dan1
    Participant

    Chris – Thanks again.

    That’s 2 days in row you’ve answered my threads and solved my problems.

    Now that I see the potential of your plugin, I look forward to using it on my live sites.

    On a side note. You should upload a picture of yourself or your logo or something, instead of using the blank avatar on your own site.

    #13322
    dan1
    Participant

    No offense intended.

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