inc/custom-less-variables.php

largo_clv_register_files()

Register which Less files are to be compiled into CSS for the user customized values to override variables.less.

Example:

largo_clv_register_files( array( ‘style.less’, ‘editor.less’ ) );

Parameters:
  • $files (array) –
    • list of filenames in the less directory
largo_clv_register_directory_paths()

Set the file path for the directory with the LESS files and URI for the directory with the outputted CSS.

Parameters:
  • $less_dir (string) –
  • $css_dir_uri (string) –
largo_clv_register_variables_less_file()

Set the filename of the variables file.

Parameters:
  • $variables_less_file (string) –
    • ‘variables.less’
class Largo_Custom_Less_Variables
Class to contain the logic
init()

Initialize the plugin

put_contents()

Write a file to disk.

Parameters:
  • $file (string) –
    • path of file to write
  • $contents (string) –
    • the content to be written to the file
get_contents()

Read a file’s contents.

Parameters:
  • $file (string) –
    • path of file to read
register_files()

Register the Less files to compile into CSS files

Parameters:
  • $files (array) –
    • the LESS files to compile into CSS
Global:

bool $ARGO_DEBUG - if false, minified CSS assets will be used by Largo, and these should be replaced with the custom-compiled assets.

register_directory_paths()

Set the file path for the directory with the LESS files and URI for the directory with the outputted CSS.

Parameters:
  • $less_dir (string) –
  • $css_dir_uri (string) –
register_variables_less_file()

Set the variables.less file

Parameters:
  • $variables_less_file (string) –
    • example ‘variables.less’
get_css()

Get the compiled CSS for a LESS file.

It will retrieved it from saved generated CSS or go ahead and compile it.

Parameters:
  • $less_file (string) –
    • the LESS file to compile
Returns:

string $he generated CSS

compile_less()

Compile a LESS file with our custom variables

Parameters:
  • $less_file ($string) –
    • ‘style.less’
Returns:

string $ the resulting CSS

variable_file_path()

Get the variable.less file path

replace_with_custom_variables()

Replace the include for the variable file with a modified version with the custom values.

style_loader_src()

Change the URL for the stylesheets that are the output of the LESS files.

template_redirect()

Intercept the loading of the page to determine if we output the rendered CSS

success_admin_notices()

Display a success message

reset_admin_notices()

Display a success message

admin_menu()

Register the admin page

admin()

Render the admin page content

admin_head()

Register Javascript files and stylesheets.

revisions_meta_box()

Revision meta box

publish_box()

Render the publish meta box

get_custom_values()

Get the custom values

Parameters:
  • $theme (string) – optional - the folder name of the theme, defaults to active theme
  • $revision (int) – optional - the revision ID, defaults to the current version
Returns:

associated $rray of values

get_post()

Get the post the data is saved to

reset_all()

Delete all custom variables saved

update_custom_values()

Save or update custom values

Parameters:
  • $values (array) –
    • an associative array of values
  • $theme (string) – optional - the theme name, defaults to the active the theme
get_editable_variables()

Parse the variable.less to retrieve the editable values

color_type_field()

Render the color field in the admin

pixels_field()

Render a pixels field in the admin

dropdown_field()

Render a dropdown in the admin