Timber not activated

'; }); return; } Timber::$dirname = array(''); class StarterSite extends TimberSite { function __construct() { add_theme_support( 'post-thumbnails' ); add_theme_support( 'custom-header' ); add_theme_support( 'menus' ); add_theme_support( 'html5', array( 'comment-list', 'comment-form', /*'search-form', */'gallery', 'caption' ) ); add_filter( 'timber_context', array( $this, 'add_to_context' ) ); add_filter( 'get_twig', array( $this, 'add_to_twig' ) ); add_action( 'init', array( $this, 'register_post_types' ) ); add_action( 'init', array( $this, 'register_taxonomies' ) ); parent::__construct(); } function register_post_types() {} function register_taxonomies() {} function add_to_context( $x ) { if(is_front_page()){ $n = 0; } else { $n = 1; } $args = array('show_home' => 0); $x['menu'] = new TimberMenu( 'Main Menu', $args); $x['posts'] = new Timber\PostQuery(); $x['devmode'] = true; $x['footblock'] = Timber::get_widgets('footer'); $x['dir'] = get_stylesheet_directory_uri(); $x['parentdir'] = get_template_directory_uri(); $x['headerimg'] = get_header_image(); $x['homepage'] = is_front_page(); $x['page'] = is_page(); $x['single'] = is_single(); // $x['title'] = is_single(); $x['notfound'] = is_404(); // $x['menu'] = new Timber\Menu( 'Main Menu' ); $uploads = wp_upload_dir(); $x['uploads'] = $uploads['baseurl']; $x['singular'] = is_singular(); $x['singlepost'] = is_singular('post'); // $x['callout'] = has_shortcode('callout'); // $x['peek'] = the_excerpt_rss(); $x['peek'] = get_the_excerpt(); $x['archive'] = is_archive(); //$x['seotitle'] = wp_title(''); $x['foo'] = 'bar'; global $post; $x['slug']=$post->post_name; return $x; } function myfoo( $text ) { $text .= ' bar!'; return $text; } function add_to_twig( $twig ) { /* this is where you can add your own functions to twig */ $twig->addExtension( new Twig_Extension_StringLoader() ); $twig->addFilter('myfoo', new Twig_SimpleFilter('myfoo', array($this, 'myfoo'))); return $twig; } } new StarterSite(); register_sidebar( array( 'id' => 'footer', 'name' => 'Footer Block', 'description' => '' )); function foobar_func( $atts ){ return "foo and bar"; } add_shortcode( 'foobar', 'foobar_func' ); function php_execute($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; } add_filter('widget_text','php_execute',100); define('ACF_EARLY_ACCESS', '5'); /* NO NO NO NO NO NO NO NO NO //////////////////// */ show_admin_bar(false); function nothing () { return false; } add_filter('category_feed_link', 'nothing'); add_filter('comments_open', 'nothing', 20, 2); add_filter('admin_footer_text', 'nothing'); add_filter('pings_open', 'nothing', 20, 2); add_filter( 'wpcf7_load_css', 'nothing' ); add_filter( 'wpcf7_autop', 'nothing' ); //remove_filter('the_content', 'wpautop'); function nowidgets() { $xs = array('Nav_Menu', 'Media_Audio', 'Media_Gallery', 'Media_Image', 'Media_Video', /*'Custom_HTML', */'Pages', 'Calendar', 'Archives', 'Links', 'Meta', 'Search', /*'Text', */'Categories', 'Recent_Posts', 'Recent_Comments', 'RSS', 'Tag_Cloud'); foreach ($xs as $x) { unregister_widget('WP_Widget_' . $x); } } add_action( 'widgets_init', 'nowidgets' ); function nologinlogo() { echo ''; } //Remove Wordpress logo from the login add_action('login_head', 'nologinlogo'); function nologo() { //Remove from dash: WP logo, Media captions echo ''; } add_action('admin_head', 'nologo'); function nobarlogo() { /* Remove wordpress logo from admin menu bar */ global $wp_admin_bar; $wp_admin_bar->remove_menu('wp-logo'); } add_action( 'wp_before_admin_bar_render', 'nobarlogo' ); function nodashboard() { $xs = array( 'normal' => array('plugins', 'right_now', 'recent_comments', 'dashboard_plugins'), 'side' => array('primary', 'secondary', 'quick_press' , 'recent_drafts'), ); global $wp_meta_boxes; foreach($xs as $x => $y){ foreach ($y as $z) { unset($wp_meta_boxes['dashboard'][$x]['core']['dashboard_' . $z]); } } } add_action('wp_dashboard_setup', 'nodashboard'); function nologincss() { wp_dequeue_style('theme-main'); } add_action( 'login_enqueue_scripts', 'nologincss' ); function nopostclasses($classes) { //Remove post classes $classes = array_diff($classes, array("tag-link", "tag-links")); return $classes; } add_filter('post_class','nopostclasses'); function nobodyclasses($wp_classes, $extra_classes) { // Remove body classes $whitelist = array('home', 'error404', 'blog', 'single', 'search', 'search-no-results'); $wp_classes = array_intersect($wp_classes, $whitelist); return array_merge($wp_classes, (array) $extra_classes); } add_filter('body_class', 'nobodyclasses', 10, 2); function nomenuclasses($var) { //Remove extra menu classes you don't use. return is_array($var) ? array_intersect($var, array('current-menu-item')) : ''; } add_filter('nav_menu_css_class', 'nomenuclasses', 100, 1); add_filter('nav_menu_item_id', 'nomenuclasses', 100, 1); function noimgatts( $html ) { //Remove height/width from inserted images $html = preg_replace( '/(width|height|class)=".*"\s/', "", $html ); return $html; } add_filter( 'post_thumbnail_html', 'noimgatts', 10 ); add_filter( 'image_send_to_editor', 'noimgatts', 10 ); function notax() { //Remove categories and tags unregister_taxonomy_for_object_type( 'post_tag', 'post' ); unregister_taxonomy_for_object_type( 'category', 'post' ); } add_action( 'init', 'notax' ); // First, this will disable support for comments and trackbacks in post types; yoast ugliness; and extra meta boxes function nojunk() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } global $wpseo_meta_columns; if ( $wpseo_meta_columns ) { remove_action( 'restrict_manage_posts', array( $wpseo_meta_columns, 'posts_filter_dropdown' ) ); remove_action( 'restrict_manage_posts', array( $wpseo_meta_columns, 'posts_filter_dropdown_readability' ) ); } $xs = array( 'post' => array('trackbacksdiv', 'postcustom', 'commentstatusdiv'/*, 'postexcerpt', 'categorydiv', 'tagsdiv-post_tag', 'authordiv' */), 'attachment' => array('commentstatusdiv','authordiv','postimagediv') ); foreach($xs as $x => $y){ foreach ($y as $z) { remove_meta_box($z, $x, 'normal'); } } remove_menu_page('edit-comments.php'); remove_menu_page('edit.php'); } add_action('admin_init', 'nojunk'); // Hide any existing comments that are on the site. function hidecomments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'hidecomments', 10, 2); function nopaths($html, $id, $caption, $title, $align, $url, $size, $alt) { $imageurl = wp_get_attachment_image_src($id, $size); $relativeurl = wp_make_link_relative($imageurl[0]); $html = str_replace($imageurl[0],$relativeurl,$html); return $html; } add_filter('image_send_to_editor','nopaths',10,8); /* End No No No //////////////////////////////////////////////////// */ //Change automated emails to come from the name of the blog and not "Wordpress" function fromwww($name = '') { return get_bloginfo('name'); } add_filter('wp_mail_from_name', 'fromwww'); //Rewrite wp-admin to simply admin function justadmin($wp_rewrite) { $wp_rewrite->non_wp_rules = array( 'admin' => 'wp-admin' ); } add_filter('generate_rewrite_rules', 'justadmin'); function add_body_class( $classes ){ global $post; if ( isset( $post ) && $post->post_type == 'page' ) { $classes[] = $post->post_name; } if ( isset( $post ) && $post->post_type == 'page' && $post->post_name != 'home-page') { $classes[] = 'page'; } if ( isset( $post ) && $post->post_parent) { $parent = get_post($post->post_parent); $classes[] = $parent->post_name . '-child'; } return $classes; } add_filter( 'body_class', 'add_body_class' ); function excerptforce() { //Force Excerpt view $post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : ''; if ( isset( $_REQUEST['mode'] ) ) { update_user_meta( get_current_user_id(), 'posts_list_mode' . $post_type, $_REQUEST['mode'] ); return; } // retrieve the list mode if ( $mode = get_user_meta( get_current_user_id(), 'posts_list_mode' . $post_type, true ) ) { $_REQUEST['mode'] = $mode; } } add_action( 'load-edit.php', 'excerptforce' ); /* Show thumbs in posts admin function thumbnail_column($columns) { $columns['thumbnail'] = 'Thumbnail'; return $columns; } add_filter('manage_posts_columns', 'thumbnail_column'); add_action('manage_posts_custom_column', 'show_thumbnail_column'); function show_thumbnail_column($name) { global $post; switch ($name) { case 'thumbnail': $thumbnail = get_the_post_thumbnail($post->ID, 'full'); echo $thumbnail; } }*/ //Gallery/////////////////////////////////////////////////////////////// /* function myGallery($string,$attr){ $output = "
"; $posts = get_posts(array('include' => $attr['ids'],'post_type' => 'attachment')); foreach($posts as $imagePost){ $output .= "
". $imagePost->post_excerpt ."
"; } $output .= "
"; return $output; } add_filter('post_gallery','myGallery',10,2); function myFooter() { ?> get_size(); // Image prefix for builtin sizes // Note: beware possible conflict with custom images sizes with the same width $widths = []; $size_based_img_name_prefix = ''; foreach ( get_intermediate_image_sizes() as $_size ) { if ( in_array( $_size, [ 'thumbnail', 'medium', 'medium_large', 'large' ] ) ) { $width = get_option( "{$_size}_size_w" ); if ( ! isset( $widths[ $width ] ) ) { $widths[ $width ] = $_size; } } } if ( array_key_exists( $img_size[ 'width' ], $widths ) ) { $size_based_img_name_prefix = $widths[ $img_size['width'] ] . '-'; $name_prefix = substr( $name, 0, strrpos( $name, '-' ) ); } else { $name_prefix = $name; } // Build our new image name $new_name = $dir . $size_based_img_name_prefix . $name_prefix . $ext; // Rename the intermediate size $did_it = rename( $image, $new_name ); // Renaming successful, return new name if( $did_it ) return $new_name; return $image; } */ /* class ContactInfo extends WP_Widget { function __construct() { parent::__construct( 'custom_widget', 'Contact Information' ); } function widget( $args, $instance ) { return 'whatever'; if(get_field('organization')){ echo get_field('organization'); } } function update( $new_instance, $old_instance ) {} function form( $instance ) {} } function myplugin_register_widgets() { register_widget( 'ContactInfo' ); } add_action( 'widgets_init', 'myplugin_register_widgets' ); */ /** * Enable ACF 5 early access * Requires at least version ACF 4.4.12 to work */ // Disable REST API link tag remove_action('wp_head', 'rest_output_link_wp_head', 10); // Disable oEmbed Discovery Links remove_action('wp_head', 'wp_oembed_add_discovery_links', 10); // Disable REST API link in HTTP headers remove_action('template_redirect', 'rest_output_link_header', 11, 0); ?>