php 将变量传递给get_template_part()作为Wordpress中的参数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 将变量传递给get_template_part()作为Wordpress中的参数相关的知识,希望对你有一定的参考价值。

function rk_get_template_part($template_slug, $args, $var_store = false) {
	
	$props = $args; 
	$template_slug = $template_slug . '.php';
	
	ob_start();

	include( locate_template($template_slug) );
	
	$template_output = ob_get_clean();
	
	if(!$var_store):
		echo $template_output;
	endif;

	return $template_output;
}

以上是关于php 将变量传递给get_template_part()作为Wordpress中的参数的主要内容,如果未能解决你的问题,请参考以下文章