Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从类别收集的帖子列表中删除链接_Php_Regex_Wordpress Theming_Wordpress - Fatal编程技术网

Php 从类别收集的帖子列表中删除链接

Php 从类别收集的帖子列表中删除链接,php,regex,wordpress-theming,wordpress,Php,Regex,Wordpress Theming,Wordpress,我有属于某个类别的帖子的链接列表。该名单载于各职位。生成列表的代码如下所示: <?php $sel_works = new WP_Query('category_name=Selected_Works&showposts=-1'); while($sel_works->have_posts()) : $sel_works->the_post(); ?> <a href="<?php the_permalink() ;?>"><?p

我有属于某个类别的帖子的链接列表。该名单载于各职位。生成列表的代码如下所示:

<?php 
$sel_works = new WP_Query('category_name=Selected_Works&showposts=-1'); while($sel_works->have_posts()) : $sel_works->the_post(); 
?>
<a href="<?php the_permalink() ;?>"><?php the_title(); ?></a><span class="CatSep"> / </span></li>
<?php endwhile; ?>

/
我想知道是否有办法删除列表中指向我们已经发布的帖子的链接。我很难定义条件,非常感谢您的帮助。


<?php
$current_id = get_the_ID();
$query_settings = array(
    'category_name'=>'Selected_Works',
    'posts_per_page'=>-1,
    'post__not_in'=>array($current_id)
);
$sel_works = new WP_Query($query_settings);
while($sel_works->have_posts()) : $sel_works->the_post(); 
?>
<a href="<?php the_permalink() ;?>"><?php the_title(); ?></a><span class="CatSep"> / </span></li>
<?php endwhile; ?>
/