教你给网站添加每日60s读懂世界api

广告

演示站点

图片版:效果图点这里     http://api.03c3.cn/zb

部署教程

方法一:图片版(最简单)

新建页面或者文章,插入以下代码,下面是效果图

<img src="http://api.03c3.cn/zb" />

效果图点这里     http://api.03c3.cn/zb

方法二:图文版和本站相同(过程较多)

  • 先在functions.php下添加以下代码
function ttsistens(){//60s
  $sixs = json_decode(file_get_contents("https://www.zhihu.com/api/v4/columns/c_1261258401923026944/items"),true)['data'][0]['content'];
  return $sixs;
};
  • 再在pages下新建ttsixs.php复制以下代码保存即可(部分数据自行修改)

1643700293 N424I8ZW484BFDJZ B

<?php

/**
 * Template name: 苏音 - 每日60s
 * Description:   苏音 - 60S
 */

get_header();
?>
<style>
.sixten{width:80%;margin:0 auto 20px auto;padding:24px;}
@media (max-width:1030px){.sixten{width:100%;}}
@media screen and (min-width:800px) and (max-width:1007px){.tens p:nth-child(4){padding:20px !important;}}
@media (min-width:800px){
.sixten>p{font-size:18px;padding:8px}
.tens p:first-child{padding:0}
.tens p:nth-child(3){width: 18%;border:2px solid #848484;margin-top:10px;padding:16px;display: inline-block;font-size:14px;border-radius:10px;}
.tens p:nth-child(4){float: right;width:80%;border:2px solid #848484;border-bottom:2px solid #848484;margin-top:10px;border-right:0;border-left:0;font-size:36px;display:inline-block;padding:10px;text-align:center;color:#f00;}
p.overclass{font-size:24px;}
}
p.overclass{text-align:center;color:#f1420d;letter-spacing:2px;padding-top:40px;}
.url{display:none;}
</style>
<main role="main" class="container">
<div class="zib-widget sixten" style="padding: 24px 24px 6px 24px;"><h3 class="title-h-center text-center">每天60秒,读懂世界</h3></div>
<div class="zib-widget sixten tens">
    <?php echo ttsistens()?>
    <div style="background:#7d7d7d;width:100%;height:2px;margin-bottom:2px;margin-top:20px;"></div>
    <div style="background:#7d7d7d;width:100%;height:1px;margin-bottom: 22px;"></div>
    <div style="background:#7d7d7d;width:100%;height:1px;margin-bottom: 2px;margin-top:20px;"></div>
    <div style="background:#7d7d7d;width:100%;height:2px;margin-bottom: 22px;"></div>
    <p class="overclass"><strong>--- 感谢您的来访,本文每日更新 ---</strong></p>
</div>
</main>
<?php
get_footer();
  • 接下来新建页面选择 (苏音 – 60S) 模板保存即可。每天自动更新

1643700409 A3 @AXTNFIMGHPWH4

如果遇到问题点这里 下载帮助 | 解压密码 | 安装遇到问题 | 免费交流群

原创文章,作者:suyin钻石会员,如若转载,请注明出处:https://www.suyin66.com/60sapi.html

   苏音资源库公众号
(0)
上一篇 2022年1月31日 上午12:21
下一篇 2023年6月3日 下午2:33

相关推荐

发表回复

登录后才能评论