我试图通过我的WordPress主题中的函数从WooCommerce获取产品类别
function get_me_list_of($atts, $content = null)
{
$args = array( 'post_type' => 'product', 'posts_per_page' => 10, 'product_cat' => $atts[0]);
$loop = new WP_Query( $args );
echo '<h1 class="upp">Style '.$atts[0].'</h1>';
echo "<ul class='mylisting'>";
while ( $loop->have_posts() ) : $loop->the_post();
global $product;
echo '<li><a href="'.get_permalink().'">'.get_the_post_thumbnail($loop->post->ID, 'thumbnail').'</a></li>';
echo '<li><a href="'.get_permalink().'">'.$loop->post->post_title.'</a></li>';
echo '<li><a href="">'.get_categories().'</a></li>';
endwhile;
echo "</ul>";
wp_reset_query();
}
?>
Run Code Online (Sandbox Code Playgroud)
上面的代码返回了一些产品,但产品类别.
当我echo '<li><a href="">'.get_categories().'</a></li>';
在上面的代码中包含它时,它返回一个数组.我该如何解决?
我如何更改此以从WooCommerce获取产品类别?
尝试构建SASS时,我在Sublime Text 2上收到以下错误。我从这里https://github.com/jaumefontal/SASS-Build-SublimeText2添加了SASS构建插件。
env:ruby_executable_hooks:没有这样的文件或目录[在0.0秒内完成,退出代码为127]
不太确定我应该在这里做什么以解决此问题。
谢谢!!
反对票数告诉我,我需要添加更多信息。问题是我不确定应该添加哪些信息。
我的SASS.sublime-build文件位于/ Library / Application Support / Sublime Text 2 / Packages / SASS Build /
{
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
"osx":
{
"path": "/Users/vskylabv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:/usr/local/bin:$PATH"
},
"windows":
{
"shell": "true"
}
}
Run Code Online (Sandbox Code Playgroud)
其中ruby_executable_hooks /Users/vskylabv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks
我已经安装了New Relic PHP代理.我的phpinfo显示它已经安装完毕.但是,在WordPress上的W3 Total Cache上,它仍然显示PHP代理被禁用.我让New Relic在其仪表板上为服务器本身工作正常,但也想让它在WordPress仪表板上显示.
谢谢!