我已经为我的主题中流行的、最近的和评论最多的帖子创建了侧边栏小部件。我有一些不包含图像缩略图的帖子。这是我的小部件中 5 个帖子的热门查询帖子
<?php if (!empty($popular_posts)) { ?>
<div class="tab-pane fade in active" id="popular">
<div class="row">
<!-- ********************************************** -->
<!-- Popular Posts Tab -->
<!-- ********************************************** -->
<?php
$YPE_options = get_option( 'YPE_sidebar_option_name' );
$popular = new WP_Query( array(
'posts_per_page' => $popular_limit,
'meta_key' => 'post_views_count', // this is function within functions.php for counting post veiews
'orderby' => 'meta_value_num',
'order' => 'DESC'
));
while ( $popular->have_posts() ) : $popular->the_post();
$html = '<article>';
$html .= '<section class="bootstrap-nav-thumb">';
$html .= '<p>';
$html .= '<a …Run Code Online (Sandbox Code Playgroud) 您好,我想使用函数从插件 WordPress 文件夹中wp_enqueue_style注册文件,而不是在目录文件夹中style.css
例如,当我想style.css从主题目录注册时,我使用下面的代码
wp_enqueue_style ('bootstrap_css', get_template_directory_uri().'/css/bootstrap.min.css');
Run Code Online (Sandbox Code Playgroud)
上面的代码是bootstrap.min.css从下面的目录注册文件
/wamp/www/wordpress/wp-content/themes/my-themefolder/css/bootstrab.min.css
Run Code Online (Sandbox Code Playgroud)
但是当插件文件夹中的文件位于下面时,我如何注册相同的文件
/www/wordpress/wp-content/plugins/my-plugin/css/bootstrap.min.css
Run Code Online (Sandbox Code Playgroud)
我必须使用任何函数而不是get_template_directory_uri()获取插件文件夹吗?