For initial activations of Largo, where no largo was previously installed
Since: 0.5.5 Returns: Bool $alse if the initial setup functions were not run, true if they were. Link: https://github.com/INN/Largo/issues/690
Performs various update functions and set a new verion number.
This acts as a main() for applying database updates when the update ajax is called.
Returns current version of largo as set in stylesheet.
Checks if updates need to be run.
Since: 0.3 Returns: boolean $result True if updates need to be run
Convert old theme option of ‘homepage_top’ to new option of ‘home_template’
Puts new widgets into sidebars as appropriate based on old theme options
Updates post prominence term descriptions iff they use the old language
- This function can be added to the init action to force an update of prominence term descriptions:
- add_action(‘init’, ‘largo_update_prominence_term_descriptions’);
This function does not touch custom prominence term descriptions, except those that are identical to the descriptions of current or 0.3 prominence term descriptions.
Since: 0.4 Uses: largo_update_prominence_term_description_single
Compares an array containing an old and new prominence term description and the appropriate slug and name to an array of current term descriptions. For each term whose current description matches the old description, the function updates the current description to the new description.
This function contains commented-out logic that will allow you to from description to olddescription
- $update (array) – The new details for the prominence tax term to be updated
- $term_descriptions (array) – Array of prominence terms, each prominence term as an associative array with keys: name, description, olddescription, slug
Update miscellaneous settings
Enable series if series have been created.
Since: 0.4 Returns: boolean $result True if series were enabled by this function
Enable the series taxonomy if the series landing pages are in use.
Since: 0.4 Returns: boolean $result If series landing pages (and series) were enabled by this function.
Remove “top-story” prominence term to avoid conflicts with homepages that will register it
Returns: array $results Deleted prominence terms
Save default values for any newly introduced options to the database
Note: this must be called before any other update function calls of_set_option, as of_set_uption defaults all values to null.
Make sure custom CSS is regenerated if we’re using custom LESS variables
Replace deprecated widgets with new widgets
- To add widgets to this list of widgets to be upgraded:
- Add the deprecated widget class and its replacement to $upgrades
Uses: largo_get_widget_basename Uses: largo_get_widget_number Since: 0.5.3
Callback for updating the Largo Featured widget in largo_replace_deprecated_widgets()
- $deprecated (array) – the deprecated widget’s $instance variables
- $replacement (array) – the replacement widget’s $instance variables
array $result the replacement widget’s $instance variables
Checks to see if a given widget is in a given region already
Since: 0.5.2 Returns: boolean $result Whether or not the widget was found.
Inserts a widget programmatically. This is slightly dangerous as it makes some assumptions about existing plugins if $instance_settings are wrong, bad things might happen
- $kind. (string) – Kind of widget to instantiate.
- $instance_settings. (array) – Settings for that array.
- $region. (string) – Sidebar region to add to.
array $result array(‘id’ => the id with number of the new widget , ‘place’ => the index of the id in its region )
Utility function to get the basename of a widget from the widget’s slug
Utility function to get the number of a widget from the widget’s slug
Add an admin notice if largo needs to be updated.
Register an admin page for updates.
DOM for admin page for updates.
Since: 0.3 Global: LARGO_DEBUG Global: $_GET
Ajax handler for when update is applied from the updates page.
Since: 0.3 Global: LARGO_DEBUG Global: $_GET
- class LargoPreviousOptions¶
A singleton utility class for preserving and retrieving previous Largo options
Call this method before saving theme options for the first time after updating Largo to preserve the state of theme options for the previous version.
Retrieve the theme options for the version of Largo that immediately preceeded the currently-deployed version.
Optionally, retrieve a previous set of theme options by passing a version string to the method.
- $largo_version (string) – for example ‘0.5.2’
Convenience function for storing the theme options for the version of the theme that immediately preceeded the currently-deployed version.
Convenience function for retrieving the theme options for the version of the theme that immediately preceeded the currently-deployed version.
If Largo needs to be updated, prevent the user from access the Theme Options edit page.
Displays a message indicating the user should update their Largo install before attempting to edit Theme Options