我在wordpress中有一个简单的登陆页面。我希望显示一条随机消息(文本字符串)。用户可以单击按钮或refesh页面以查看新评论。该文本当前存储在excel csv文件中。是否有任何简单的插件可用或者是否可以轻松编码为wordpress或类似?
答案 0 :(得分:0)
您可以使用此插件,并使用常规输入按钮刷新页面,每次刷新页面都会得到一个新的报价。
http://wordpress.org/extend/plugins/quotes-collection/other_notes/
您网页中的包括:
[quotcol1 orderby =“random”limit = 1]
或者您可以使用随附的quotescollection_quote()函数并自动刷新,并显示随机函数。
答案 1 :(得分:0)
这是我用来替换载入中的随机Chuck Norris事实的Chuck Norris作者简介的内容。另外,还有一个重新加载当前页面的链接:
<?php if(get_the_author_meta('display_name') == 'Chuck Norris'){
$messages = array(
'Chuck Norris doesn\'t read books. He stares them down until he gets the information he wants.',
'Time waits for no man. Unless that man is Chuck Norris.',
'If you spell Chuck Norris in Scrabble, you win. Forever.',
'Chuck Norris breathes air ... five times a day.',
'In the Beginning there was nothing ... then Chuck Norris roundhouse kicked nothing and told it to get a job.',
'When God said, "Let there be light!" Chuck said, "Say Please."',
'Chuck Norris has a mug of nails instead of coffee in the morning.',
'If Chuck Norris were to travel to an alternate dimension in which there was another Chuck Norris and they both fought, they would both win.',
'The dinosaurs looked at Chuck Norris the wrong way once. You know what happened to them.',
'Chuck Norris\' tears cure cancer. Too bad he has never cried.',
'Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light',
);
global $wp;
$current_url = home_url( add_query_arg( array(), $wp->request ) );
echo "<p>".$messages[rand(0, count($messages) - 1)]."<br><br><a href=\"".$current_url."#author\" style=\"text-decoration:underline;\">Click for another Chuck fact</a> -- if your ego can handle it!</p>";
} else {
?>
<p><?php echo esc_attr(get_the_author_meta('description')); ?></p>
<?php } ?>