Viewing 1 replies (of 1 total)
  • Hi there,

    You can definitely add more than one custom metadata field, as you can see in the examples in the documentation. It is possible that there is a syntax error in your filter… these things happen to us all the time as well, syntax errors sometimes get overlooked.

    Could you please share with us the fragment of code you have placed in your functions.php file so we can check it out?

    The right way to add multiple custom fields in the filter would be something like:

    add_filter( ‘wpsl_frontend_meta_fields’, ‘custom_frontend_meta_fields’ );
    function custom_frontend_meta_fields( $store_fields ) {
    $store_fields[‘wpsl_my_field_1’] = array(
    ‘name’ => ‘my_field_1’
    );
    $store_fields[‘wpsl_my_field_2’] = array(
    ‘name’ => ‘my_field_2’
    );
    return $store_fields;
    }

    So, if for instance you have created two custom metadata fields with the wpsl_meta_box_fields filter, and then you have included the JSON data in the frontend response with the wpsl_frontend_meta_fields, the third step to show those fields is to use the wpsl_listing_template filter if you want to use the custom data in the store listing template, or the wpsl_info_window_template filter if you want to use it in the info window template.

    I believe you are missing this last point, the need to modify the templates that output the actual content to the browser.

    I hope this clarifies things, otherwise let us know :)`

Viewing 1 replies (of 1 total)
  • The topic ‘Add Custom Meta Data/Fields to the Store Locations’ is closed to new replies.