Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter evgenyp

    (@evgenyp)

    I use 52 fields in the right place in the custom post output on the front end. All those 20 posts use custom post types.
    And I use wp_localize_script( 'my-scripts', 'myOptions', $context['options'] ); for the only reason – have an access through the object myOptions.

    So data is in DB, it’s static.
    I didn’t to mention that I use Timber, don’t know if it’s matter.

    
    // add fields from options page
    $context['options'] = get_fields( 'options' );
    
    
    // add site options to combined js file
    wp_localize_script( 'my-scripts', 'myOptions', $context['options'] );
    
    Thread Starter evgenyp

    (@evgenyp)

    @joyously could you explain, please, how can I get this.
    Probably, you have useful links.
    My Custom Post type contains 52 fields
    And I have 20+ posts that use that CPT. So I have a big volume of data.
    And I don’t understand what should I do in php and javascript file.
    Sorry, i really confused.
    Appreciate your tips.

    Thread Starter evgenyp

    (@evgenyp)

    @joyously The data is not dynamic. I mean, i filled it’s in a Dashboard, saved and that’s it.

    If it’s not dynamic data, why isn’t it in a file already?

    Because I wrote earlier, what method i’ve used to add the data – wp_localize_script
    To have an access to the data I used this method and created myOptions object to access data.
    What can I use instead?

    • This reply was modified 5 years, 8 months ago by evgenyp.
Viewing 3 replies - 1 through 3 (of 3 total)