Skip to content

jlawrence-yellostudio/craftcms-prune

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Twig Prune for Craft CMS

Add a Twig filter for CraftCMS templates to "prune" out fields of entries.

Installation

  1. Move the prune directory into your craft/plugins directory.
  2. Go to Settings > Plugins from your Craft control panel and enable the prune plugin

Usage

The primary reason for this is to control the fields being output to json_encode.

{{ craft.entries.section('news').find() | prune(['title', 'body']) | json_encode() | raw }}

The above template will get all entries from the "news" section, grab just the title and body fields from each, and then output it to JSON.

About

CraftCMS Prune Twig plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%