WordPressMVC

  1. Get Started
  2. Documentation
  3. Tutorials
  4. Blog
  1. Documentation
  2. Tutorials
v1.0.8 Login
  • Blog
  • Download
  • Get Started
  • The Basics
    • Ayuco
    • Main Class
    • Configuration
  • Hooks
    • Actions
    • Filters
    • Widgets
    • Shortcodes
  • MVC
    • Models
    • Post Models
    • Option Models
    • Term Models
    • User Models
    • Views
    • Controllers
  • Resources
    • Assets
    • Styles
    • Scripts
  • Advanced
    • Request
    • Response
    • Localization
    • Cache
    • Logger
    • Database
    • Testing
    • Deployment
    • Functions
    • Add-ons

Functions

Last updated: January 12, 2020

List of the global functions included in the framework. These can be used anywhere.


get_bridge

Returns a Main Class instance based on a given namespace.

/**
 * @param string $namespace
 *
 * @return WPMVC\Main|null
 */
$main_class = get_bridge( $namespace );
ParameterTypeDescription
$namespacestringProject namespace.

Returns

Returns a main class instance or null.


resize_image

Returns the URL of a resized image.

/**
 * @param string $path_url Path or original url.
 * @param int    $width    Width to resize to.
 * @param int    $height   Height to resize to.
 * @param bool   $crop     (Optional) Flag that indicates if image should crop.
 *                         DEFAULT: true
 * @param int    $id       (Optional) Unique identifier for if there are
 *                         conflicts with other images. DEFAULT: null
 *
 * @return string
 */
$url = resize_image( $path_url, $width, $height, $crop, $id );
ParameterTypeDescription
$path_urlstringPath or URL of the original image.
$widthintWidth to resize to.
$heightintHeight to resize to.
$cropbool(Optional) A flag that indicates if the image should crop. DEFAULT : true
$idint(Optional) Unique identifier for if there are conflicts with other images. DEFAULT: null

Returns

Returns string URL.

Storage

This function will create a re-sized version of the image and store it on WordPress’ uploads folder.

assets_url

Returns the URL of an asset file.

/**
 * @param string $relative_path Relative path in assets folder.
 * @param string __FILE__       Current file caller (constant required).
 * @param string $scheme        (Optional) Forces url scheme
 *                              (ie "html" or "https"). DEFAULT: null
 * @param bool   $is_network    (Option) Flag that indicates if wordpress has
 *                              a network setup. DEFAULT: false
 */
$url = assets_url( $relative_path, __FILE__, $scheme, $is_network );

/**
 * Sample
 */
$url = assets_url( 'img/logo.png', __FILE__ );

/**
 * Sample forcing HTTPS
 */
$url = assets_url( 'js/jquery.my-plugin.js', __FILE__, 'https' );

/**
 * Sample forcing HTTPS checking SSL flag
 */
$url = assets_url( 'js/jquery.my-plugin.js', __FILE__, is_ssl() ? 'https' : 'http' );

/**
 * Sample on network setups
 */
$url = assets_url( 'img/logo.png', __FILE__, null, true );

theme_view

Prints a view located in theme.

Notice

Available only for themes.
© 2023 10 Quality Studio . All rights reserved.
Search in: