简体   繁体   English

如何在 Wordpress 中创建带有动态链接的按钮(使用类别中的最后一篇博客文章链接自动更新)

[英]How to create button with dynamic links (that automatically updates with the last blog post link in a category) in Wordpress

As title says I am trying to have a button on my home page that automatically updates the link with the link of the last blog post in a certain category正如标题所说,我正在尝试在我的主页上设置一个按钮,该按钮会自动使用特定类别中最后一篇博客文章的链接更新链接

You need to code shortcode (in child theme functions.php for example or make a plugin), that will generate this button HTML output, fetch last post url and add it to button. You need to code shortcode (in child theme functions.php for example or make a plugin), that will generate this button HTML output, fetch last post url and add it to button. Then you can use something like [last_post_button] anywhere where you need.然后你可以在任何你需要的地方使用类似 [last_post_button] 的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM