Support

Account

Home Forums Feature Requests Export and page localization

Helping

Export and page localization

  • When i generate export php code, all generated group has own location. For example when i create group for custom post type “games” i get code:

    ‘location’ => array (
    array (
    array (
    ‘param’ => ‘post_type’,
    ‘operator’ => ‘==’,
    ‘value’ => ‘games’,
    ),
    ),
    ),

    And this is very nice, because i can create this custom post with php code.

    Now i create custom group for specyfic page and after export i get:

    ‘location’ => array (
    array (
    array (
    ‘param’ => ‘page’,
    ‘operator’ => ‘==’,
    ‘value’ => 201,
    ),
    ),
    ),

    and it’s not nice, because when I programically create pages, i can not be sure that this site gets id = 201.
    Maybe code like ‘value’ => get_page_by_path(‘/supauber’)->ID may fix this issue? Hmmm… But admin can change url…
    Maybe you can add option for this or something like that?

  • If you’re creating pages and field groups using code I would suggest that when you create the page in question that you store the post_id of the new page in an option value. Then alter the field group php to use that value for the location rule.

    
    'location' => array (
      array (
        array (
          'param' => 'page',
          'operator' => '==',
          'value' => get_option('my_option_name'),
        ),
      ),
    ),
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.