• Instead of changing NextGEN Gallery settings in wp-admin, I want to set the same options programmatically, like using wp cli or an SQL command, , so that they can take effect when provisioning a WordPress instance using Ansible or Docker.

    I compared wp option list before and after changing and saving gallery settings -> basic thumbnails, but I did not find the relevant diff in ngg_options.

    What is the recommended way to set ngg gallery settings programmatically?

Viewing 1 replies (of 1 total)
  • Benjamin

    (@benjaminowens)

    Hi @openmindculture!

    You can change the display type settings programmatically by using NextGEN’s API, like so:

    $mapper = C_Display_Type_Mapper::get_instance();
    $display_type = $mapper->find_by_name(NGG_BASIC_THUMBNAILS);
    $display_type->settings[‘ajax_pagination’] = ‘1’;
    $mapper->save($display_type);

    That will find NextGEN’s custom post entry that stores the basic thumbnails attributes & settings, turn on the ajax pagination setting, and then save that entry back to the DB.

    Due to legacy issues it’s best if you save boolean options as a string, such as ‘1’ for TRUE and ‘0’ for FALSE.

    Let me know if you have any other questions!

Viewing 1 replies (of 1 total)
  • The topic ‘Change gallery settings programmatically?’ is closed to new replies.