Beispiel #1
0
 function testCommentForm()
 {
     $post_id = $this->factory->post->create();
     $form = TimberHelper::ob_function('comment_form', array(array(), $post_id));
     $form = trim($form);
     $this->assertStringStartsWith('<div id="respond"', $form);
 }
 /**
  *
  *
  * @return string
  */
 public function call()
 {
     $args = $this->_parse_args(func_get_args(), $this->_args);
     if ($this->_use_ob) {
         return TimberHelper::ob_function($this->_function, $args);
     } else {
         return call_user_func_array($this->_function, $args);
     }
 }
 function testAgainstFooterFunctionOutput()
 {
     global $wp_scripts;
     $wp_scripts = null;
     wp_enqueue_script('colorpicker', false, array(), false, true);
     wp_enqueue_script('fake-js', 'http://example.org/fake-js.js', array(), false, true);
     $wp_footer = TimberHelper::ob_function('wp_footer');
     global $wp_scripts;
     $wp_scripts = null;
     wp_enqueue_script('colorpicker', false, array(), false, true);
     wp_enqueue_script('fake-js', 'http://example.org/fake-js.js', array(), false, true);
     $str = Timber::compile_string('{{function("wp_footer")}}');
     $this->assertEquals($wp_footer, $str);
     $this->assertGreaterThan(50, strlen($str));
 }
Beispiel #4
0
<?php

/**
 * @package   Gantry 5 Theme
 * @author    RocketTheme http://www.rockettheme.com
 * @copyright Copyright (C) 2007 - 2015 RocketTheme, LLC
 * @license   GNU/GPLv2 and later
 *
 * http://www.gnu.org/licenses/gpl-2.0.html
 */
defined('ABSPATH') or die;
/*
 * The template for displaying BBPress pages
 */
$gantry = Gantry\Framework\Gantry::instance();
$theme = $gantry['theme'];
// We need to render contents of <head> before plugin content gets added.
$context = Timber::get_context();
$context['page_head'] = $gantry->isCompatible('5.1.5') ? $theme->render('partials/page_head.html.twig', $context) : null;
$context['posts'] = Timber::query_post();
$context['content'] = TimberHelper::ob_function('the_content');
Timber::render('bbpress.html.twig', $context);