我正在写一个wordpress插件,我想隐藏其 Headers 中包含特定字符串的帖子/页面 .
例如,我想隐藏 Headers 所包含的所有帖子/页面:[something123]
显示这个帖子/页"Lorem Ipsum"隐藏该帖子/页面"Lorem Ipsum [something123]"隐藏该帖子/页面"Hello World [something123]"显示这个帖子/页"Hello World"
在你的主题目录中找到loop.php
在它里面应该有一条这样的线
<?php while ( have_posts() ) : the_post(); ?>
伪代码:
if (get_the_title() contains "") { endwhile; }
http://codex.wordpress.org/Function_Reference/get_the_title
您还可以使用过滤器:
http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
虽然我不想为你写一个=) . 也许其他人会 .
1 回答
在你的主题目录中找到loop.php
在它里面应该有一条这样的线
伪代码:
http://codex.wordpress.org/Function_Reference/get_the_title
您还可以使用过滤器:
http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
虽然我不想为你写一个=) . 也许其他人会 .