我有问题。我需要插入此wp查询$cust_loop = new WP_Query( \'author=123\' );
但我无法删除$args
from$cust\\U loop=新的WP\\U查询($args);
And i tried everything like
$cust\\U loop=新的WP\\U查询($args,“author=123”);`
我只想按特定用户显示帖子,谢谢:)
<小时>
if($typecount>0) {
class con_latest_reviews extends WP_Widget {
function con_latest_reviews() {
/* Widget settings. */
$widget_ops = array( \'classname\' => \'Continuum Latest Reviews\', \'description\' => \'Displays a single review type by most recent or highest rated. Add multiple widgets for each review type.\' );
/* Widget control settings. */
$control_ops = array( \'width\' => 250, \'height\' => 350, \'id_base\' => \'con_latest_reviews\' );
/* Create the widget. */
$this->WP_Widget( \'con_latest_reviews\', \'Continuum Latest Reviews\', $widget_ops, $control_ops );
}
function widget( $args, $instance ) {
extract( $args );
/* User-selected settings. */
$title = apply_filters(\'widget_title\', $instance[\'title\'] );
$sort = $instance[\'sort\'];
$reviewtype = $instance[\'reviewtype\'];
$numreviews = $instance[\'numreviews\'];
//get review type for More link URL purpose
$reviewtypeurl = $reviewtype;
if($reviewtypeurl=="game") $reviewtypeurl="video-game";
if($sort=="highest-rated") {
$feedsort="meta_value";
$metakey="&meta_key=Rating";
} else {
$feedsort="date";
$metakey="";
} ?>
<div class="tabdiv reviews <?php echo $reviewtype; ?>">
<?php
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
if ( $title ) { ?>
<?php echo str_replace(\'<h2 class="gentesque">\',\'<h2 class="gentesque">\',$before_title); ?>
<div class="icon <?php echo $reviewtype; ?>"> </div>
<?php echo $title; ?>
<?php echo $after_title; ?>
<?php }
/* HTML output */
?>
<ul>
<?php // setup the query
$args=\'&posts_per_page=\'.$numreviews.\'_reviews&order=DESC&orderby=\'.$feedsort.$metakey;
$cust_loop = new WP_Query($args);
if ($cust_loop->have_posts()) : while ($cust_loop->have_posts()) : $cust_loop->the_post(); $postcount++;
// if we\'re sorting by rating and this item does not have a rating, hide it
$rating = get_post_meta(get_the_ID(), "Rating", $single = true);
if(($rating && $feedsort=="meta_value") || ($feedsort!="meta_value")) {
$ratings = con_setup_rating($rating); //setup the ratings array
?>
<li>
<?php con_show_rating($ratings[0], $ratings[1], $ratings[2]); // show the stars or hearts ?>
<a class="post-title" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</li>
<?php } ?>