Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

Dynamic Starting Address for Loaded Results Page

Home Forums F.A.Q Dynamic Starting Address for Loaded Results Page

This topic contains 4 replies, has 2 voices, and was last updated by  jpequens 12 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #43792

    jpequens
    Participant

    Hello –

    I have setup various pages for SEO purposes on my site with the url structure:  mysite.com/ohio/cleveland  or mysite.com/new-york/new-york etc. where I have a state and a city.

    I have custom fields on these pages as well that contain that state and city.

    On these pages I want a list of results to populate automatically as if someone typed in that city and sate for their search.

    I see how to do this using both the “Enable Page Load Feature” and the “Starting Address” feature when creating a form.  However, I do not want to create a new form for every city and state combination.

    Is there an easy way for me to dynamically insert the “Starting Address” for these pages using only one form?

    I feel like it should be straight forward but I can’t seem to figure how to do it.

    Thanks!

     

    #43859

    jpequens
    Participant

    I’ve tried following the information from this page and still not having any luck:

    https://wordpress.org/support/topic/possible-to-set-the-default-starting-address-on-the-fly

    add_filters is something I’ve not done much with before, so I’m not sure If I need to do anything special

    I’ve added this to my functions.php file (I’m using form id=5 and a advance custom field ‘city_address’)

     

    function gmw_formload( $gmw ) {

    $city_cord = the_field(‘city_address’);

    if ( $gmw[‘ID’] == 5) {
    $gmw[‘page_load_results’][‘address_filter’] = $city_cord;
    }

    return $gmw;
    }
    add_filter( ‘gmw_pt_default_form_values’ , ‘gmw_formload’, 99 );

     

    Feel like I am close…any help would be very much appreciated

    #44015

    jpequens
    Participant

    Finally got it to work.  Here is what it is if anybody needs it.  ‘city_address’ is the custom filed I am using so change that as needed.  I also have this for Form ID 5.  Just add the below to the functions.php file and change your form id or custom field as needed.

    #56444

    Eyal Fitoussi
    Keymaster

    Hello jpequens,

    I apologize for missing out your topic, I just came a cross it.

    However, I am glad you found a solution and thank you for sharing it. I am sure others will appreciate it as well.

    #58352

    jpequens
    Participant

    Hello –

    I had the above code on this thread working to filter out search results on pages like this:

    Orlando

    This way it would load only locations nearby Orlando FL (I was passing in the city with a custom field).

    It looks like that filter no longer works with the update. Any suggestions on where to make the adjustment? Is this now a premium feature?

    Any direction would be helpful.

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.