Code Monkey home page Code Monkey logo

timber-commented-include's Introduction

Timber Commented Include

This is a simple port of djboris88/twig-commented-include to be used with Timber for WordPress.

It helps debugging and navigating through many Twig partials in your project. It outputs a HTML comments before and after each include statement while rendering the template. Comments look like this:

<!-- Begin output of "_partials/_navigation.twig" -->
<div class="navigation" role="navigation" data-navigation>...</div>
<!-- / End output of "_partials/_navigation.twig" -->

Installation

To install the latest stable version of this component, open a console and execute the following command:

composer require djboris88/timber-commented-include

Usage

To be able to see the commented output, WP_DEBUG has to be defined and set as true in wp-config.php file.

The Twig Extension will automatically be registered and applied. If the WordPress add_filter function is not available when that happens, it will fail. In that case, you will need to call initialization yourself at an appropriate time after WordPress itself is initialized:

if (function_exists('\Djboris88\Timber\initialize_filters')) {
  \Djboris88\Timber\initialize_filters();
}

timber-commented-include's People

Contributors

djboris88 avatar benvoynick avatar graham73may avatar

Stargazers

 avatar Jarkko Saltiola avatar Alessandro Benassi avatar  avatar Markus Müller avatar  avatar Wenderson Fernandes avatar Marcin Krzemiński avatar Lukas Gächter avatar

timber-commented-include's Issues

Theme no longer working after install : Unknown "extends" tag

After I install this with:
composer require djboris88/timber-commented-include --dev
My theme no longer works, and I get these errors:
Fatal error: Uncaught Twig_Error_Syntax: Unknown "extends" tag. Did you mean "extends"? in ...\wp-content\themes\mytheme\templates\wordpress\page.twig on line 1
Twig_Error_Syntax: Unknown "extends" tag. Did you mean "extends"? in ...\wp-content\themes\mytheme\templates\wordpress\page.twig on line 1

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.