《暴风雨》——莎士比亚
凡是过往,皆为序章(What's past is prologue)
众所周知,程序猿“讨厌”随机数。所以我从不在嚯9时摇🎲。但是线上的是“伪随机”,可以加入一点自己的小心思 。
给尘封已久的文章一个亮相的机会~
新建一个页面模板,此处我就用余半仙说的:手气不错
<?php
/*
Template Name: 手气不错
*/
get_header();
?>
<style>
.r_title{
position: fixed;
margin-top: 2em;
margin-left: 1em;
font-weight: bold;
font-size: xx-large;
color: mediumpurple;
}
</style>
<script>
function look_ya(secs, url){
let jumpTo=document.getElementById('jumpTo');
jumpTo.innerHTML=secs;
if(--secs>0){
setTimeout(function(){ look_ya(secs,url)},1000);
}else{
location.href= url;
}
}
</script>
<section class="container" >
<?php $rand_post = get_posts('numberposts=1&orderby=rand&post_status=publish');
foreach ($rand_post as $post) : ?>
<h2 class="r_title"><span id="jumpTo" >3</span> 秒后前往 “<?php the_title(); ?>”<h2>
<script> look_ya(3, "<?php the_permalink(); ?>");</script>
<?php endforeach; ?>
<p><image src="/wp-content/uploads/2021/10/ya.png" style="max-width: 710px;margin-top: 0.5em;"></image></p>
</section>
页面样式是根据主题自定义的,功能核心代码只有4行~
<?php $rand_post = get_posts('numberposts=1&orderby=rand&post_status=publish');
foreach ($rand_post as $post) : ?>
<script> location="<?php the_permalink(); ?>";</script>
<?php endforeach; ?>
让 余半仙 算算下一个页面是哪里 (¬︿̫̿¬☆)
最后更新于 7月 前 by mouc
余半仙!这是炮萝?
@Js.nake 是业余炮萝,基本不开炮,只盖房子- –
@mouc 哈哈,是的,这边也沉迷盖房,无法自拔
@潯 黑历史无处遁形
博主的字体很有个性,复古的低像素,赞个~