admin管理员组文章数量:1135640
Ideally, the goal is to show the block number (ie: 782667) instead of the date value (ie: 26 March 2023 4:44PM CT) on all wordpress posts and pages that currently display it.
There's maybe a script we can add to the functions.php
in the wordpress child-theme currently in user?
Ideally, the goal is to show the block number (ie: 782667) instead of the date value (ie: 26 March 2023 4:44PM CT) on all wordpress posts and pages that currently display it.
There's maybe a script we can add to the functions.php
in the wordpress child-theme currently in user?
2 Answers
Reset to default 3I have no idea what a 'block number' is, but when themes output the date for a post they will use either the_date()
or the_time()
(or both). You can replace the output using the filters the_date()
or the_time()
:
add_filter(
'the_date',
function( $the_date, $format ) {
$block_number = 'whatever a block number is';
return $block_number;
},
10,
2
);
We ended up building Bitcoin Block Date Converter, a plugin for WordPress and compatible with the majority of themes using this for
$ date -ud "1/1/2017"
Sun Jan 1 00:00:00 UTC 2017
$ date -ud "1/1/2017" +%s
1483228800
+add three zeroes to that number and append it to a blockchain.com URL:
https://www.blockchain.com/btc/blocks/1483228800000
And there you have it the block number:
446033 (Main Chain) 2017-01-01 00:02:33
For more info:
Repo on GitHub
Demo web site
Donate on Geyser
.
本文标签: functionsHow to display *block number* instead *date value* on Wordpress posts
版权声明:本文标题:functions - How to display *block number* instead *date value* on Wordpress posts? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736851719a1955535.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
blockNumber
is the sequential number of a block mined in the bitcoin blockchain, every block is mined in a specific time, one every 10-15 min circa. For example, block number 783184 was mined on 2023-03-30 07:02. Ideally the function will read the post/page date and convert it at blockNumber. Not sure is clear but please let me know if you have any further questions – SuperAtic Commented Mar 30, 2023 at 13:22