本文整理汇总了PHP中TimberHelper::ob_function方法的典型用法代码示例。如果您正苦于以下问题:PHP TimberHelper::ob_function方法的具体用法?PHP TimberHelper::ob_function怎么用?PHP TimberHelper::ob_function使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimberHelper
的用法示例。
在下文中一共展示了TimberHelper::ob_function方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCommentForm
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);
}
示例2: call
/**
*
*
* @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);
}
}
示例3: testAgainstFooterFunctionOutput
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));
}
示例4: defined
<?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);