Code Manas theme: 1.1.7 update

Posted on

Code Manas theme has been updated to 1.1.7 on May 6, 2019 with some major code refactoring. The major update is that the code for theme options added using Kirki framework has been refactored to Object Oriented Programming(OOP). All the code for the Kirki fields are now moved to a newly defined class Code_Manas_Kirki_Fields which is defined in a new file inside inc/classes/class-cm-kirki-fields.php.

For the users using the child theme please note that code_manas_get_theme_mods_defaults has been removed. If you are using this function in your child theme, it may cause isssue.

To resolve the issue replace code_manas_get_theme_mods_defaults with cm_kirki_fields()->get_theme_mods_defaults()

Following are the details of the class:

Code_Manas_Kirki_Fields

  • Singleton class meaning a single instance of the class can be used throughout the theme which is instansiated by cm_kirki_fields() function
  • Add sections, panels, settings, controls using Kirki framework.

Properties:

  • $_instance –  private static which contains the instance of the class

Methods:

  • instance() – Creates an instance of the class
  • __construct() –  Calls the main methods in the class
  • control_styles() – Add style for controls which is loaded only on Customizer preview.
  • kirki_config() – Add Kirki config for this theme
  • add_panels() – Add panels for the theme
  • sections_data() – Returns an array of sections to be added.
  • add_sections() – Add sections to the panels using the data returned by sections_data()
  • get_theme_mods_defaults() – Returns all the default theme mods value in an array
  • fields_data() – Returns an array of fields( theme options settings ) to be added.
  • add_fields() – Add fields to the sections using data returned by fields_data()

Other minor updates include:

  • Updated: Update pot file.
  • Added: Add $ver variable for versioning of customizer script.
  • Added: Add option to change the header background color.
  • Fixed: Fix padding issue when Featured section and secondary menu is disabled.
  • Removed: Remove code_manas_get_theme_mods_defaults function

A new feature is also added in the theme. Now you can change the background of the header from the customizer in a simple click.

Leave a Reply

Your email address will not be published. Required fields are marked *