• Hi,

    we need to customize the theme and need to get pure store id. In the template we can see <% id %>. We need the vvalue of it and then use it in the PHP code. Is there a way to get it, so we cen use something like get_post_field(…$storeid….).

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    There are different ways to get the ID value, but what exactly are you planning to do?

    Thread Starter rombaaa

    (@rombaaa)

    We need to get the ID within the template. There is a code which uses <% =id %> as the store id (class or id of an element). We can’t save this into a variable and call it within the template. This id will be used to get store info of a given field and grab the field value using get_post_field(…$storeid….).

    The template is in out child theme.

    For each location, we want to add some content saved in a post. Because the content is large and uses jquery tabs, etc. it is not possible to add it simply to the large description field.

    Thank you.

    I have the same question.

    I need to get the ID (or even better, the ability to have all the meta data from the current store) so I can grab some additionnal datas from users and posts.

    Thanks!

    Plugin Author Tijmen Smit

    (@tijmensmit)

    If you want to get the ID in the single store template, then you can create a custom template first. After line 20 in the code you can do ‘$queried_object->ID’ to access the current post ID.

    To get the meta data you can do something like this.

    
    $address = get_post_meta( $queried_object->ID, 'wpsl_address', true );
    $city    = get_post_meta( $queried_object->ID, 'wpsl_city', true );
    $country = get_post_meta( $queried_object->ID, 'wpsl_country', true );
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘get store id in the template to use in PHP code’ is closed to new replies.