GithubHelp home page GithubHelp logo

inpsyde / plugin-templating-utils Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 3.0 10 KB

Provides utility functions for templating functionality in plugins.

License: MIT License

PHP 100.00%
wordpress php7 template

plugin-templating-utils's Introduction

Plugin Templating Utils

A Composer package that provides utility functions to templating functionality in plugins..


Functions

Inpsyde\plugin_file_base_dir()

Given a file a file inside a plugin directory, no matter how deep in the directory three, returns the absolute path to root directory of the plugin.

Inpsyde\plugin_template_part()

Similar to get_template_part() loads a template from a plugin directory. The plugin folder where to search is obtained from first argument, that can be a file in the target plugin directory, no matter how deep in the directory three.

Templates to be searched pass through 'plugin_template_part_templates' filter.

Inpsyde\find_plugin_template_part()

Similar to plugin_template_part() (also trigger same filter) it returns the path of found template instead of including it.

Inpsyde\plugin_file_path()

Similar to get_theme_file_path() returns the path of a file inside a plugin directory. The target plugin is obtained from first argument, that can be a file in the target plugin directory, no matter how deep in the directory three.

Returns empty string if the file does not exists.

Returned value passes through 'plugin_file_path' filter.

Inpsyde\plugin_file_uri()

Similar to get_theme_file_uri() returns the URL of a file inside a plugin directory. The target plugin is obtained from first argument, that can be a file in the target plugin directory, no matter how deep in the directory three.

Returns empty string if the file does not exists.

Returned value passes through 'plugin_file_uri' filter.

Inpsyde\plugin_template_part_fallback()

Like Inpsyde\plugin_template_part() but fallbacks to theme (or child theme) if file is not found in plugin.

Inpsyde\plugin_file_path_fallback()

Like Inpsyde\plugin_file_path() but fallbacks to theme (or child theme) if file is not found in plugin.

Inpsyde\plugin_file_uri_fallback()

Like Inpsyde\plugin_file_uri() but fallbacks to theme (or child theme) if file is not found in plugin.


Requirements

  • PHP 5.6+
  • Composer to install

Installation

Via Composer, package name is inpsyde/plugin-templating-utils.


License and Copyright

Copyright (c) 2017 Inpsyde GmbH.

"Plugin Templating Utils" code is licensed under MIT license.

The team at Inpsyde is engineering the Web since 2006.

plugin-templating-utils's People

Contributors

gmazzap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

tounsils

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.