Skip to content

Instantly share code, notes, and snippets.

View kunsang's full-sized avatar
🚽
Zähneputzen, Pullern und ab ins Bett

Kunsang Norbu Tsering kunsang

🚽
Zähneputzen, Pullern und ab ins Bett
  • Fabrik 19 AG
  • Germany
  • 02:02 (UTC +01:00)
View GitHub Profile
https://timber.github.io/docs/v2/guides/context/
- The context in Timber for WordPress refers to the set of variables passed to the Twig template.
- The $data array in the example contains variables that will be available in the Twig template.
- Timber::context() provides a set of useful default variables that can be used in the template.
- Additional variables can be added or existing ones overwritten in the context.
- The global context is cached and can be accessed using Timber::context_global().
- The global context can be extended using the timber/context filter to add custom data.
- Timber automatically populates the context with variables like post, posts, term, terms, or author based on the template type.
- The post variable in singular templates and the posts variable in archive templates provide access to the relevant content.
@kunsang
kunsang / wp.sh
Last active December 22, 2017 21:43 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
@kunsang
kunsang / Perv Orange Moonlight.tmTheme
Created January 14, 2014 03:24
customised Perv Orange.tmtheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Perv Orange Moonlight</string>
/*-----------------------------------------------------------------------------------*/
/* Adds new body classes
/*-----------------------------------------------------------------------------------*/
add_filter('body_class', 'add_browser_classes');
function add_browser_classes($classes){
if(is_singular()) {
global $post;
$classes[] = $post->post_name;
}