WordPress How To Add meta tags to the header

By default, WordPress does not add the needed tags to the head section, so that previews on social media look good. It does to a certain degree especially if you add featured images manually to a blog post.

However, if you’re automating any part of the blog post creation, then there is a way to search the blog content for a suitable image and use that. This then happens dynamically.

Add the following code to your theme’s function.php file: –

// Add custom meta to the header

function set_header_metadata(){

global $post;

$post_id = $post->ID;
if (empty($post_id)) {

$PageTitle = $post->post_title;
$posttype = $post->post_type;
$permalink = get_permalink($post->id);

// Attempt to retrieve the img source
$doc = new DOMDocument();
$tags = $doc->getElementsByTagName(‘img’);
$PageImage = null;
foreach ($tags as $tag) {
if (!$PageImage) {
$PageImage = $tag->getAttribute(‘src’);

if (strpos(strtolower($PageImage),’.jpg’) !== false ||
strpos(strtolower($PageImage),’.jpeg’) !== false) {
if (strpos(strtolower($PageImage),’.gif’) !== false) {

$metatag = ‘<meta property=\”og:title\” content=\”‘.$PageTitle.’\” />’;
$metatag .= ‘<meta property=\”og:image\” content=\”‘.$PageImage.’\” />’;
$metatag .= ‘<meta property=\”og:image:type\” content=\”‘.$PageContent.’\” />’;
$metatag .= ‘<meta property=\”og:type\” content=\”article\” />’;

echo $metatag;
add_action(‘wp_head’, set_header_metadata);

You can see this being used by looking at blog posts on CryptoSocialClub, where we have feeds coming in from blog authors. The blog posts are created automatically, so now it adds the meta tags correctly so they look great on Facebook, Google+ etc. etc.

Posted in News | Leave a comment

The Blockchain Explained

Blockchain explained in plain English


Understanding how blockchain works and identifying myths about its powers are the first steps to developing blockchain technologies

Video: Blockchain in 60 seconds

After spending two years researching blockchain and the evolution of advanced ledger technologies, I still find a great spectrum of understanding across my clients and business at large about blockchain. While ledger superpowers like Hyperledger, IBM, Microsoft and R3 are emerging, there remains a long tail of startups trying to innovate on the first generation public blockchains. Most of the best-selling blockchain books confine themselves to Bitcoin, and extrapolate its apparent magic into a dizzying array of imagined use cases. And I'm continuously surprised to find people who are only just hearing about blockchain now.

It can seem that everyone is talking about blockchain and ledger technologies, but the truth is most people are not yet up to speed. No one should be shy to ask what blockchain is really all about.

Many blockchain primers and infographics dive into the cryptography, trying to explain to lay people how "consensus algorithms", "hash functions" and digital signatures all work. In their enthusiasm, they can speed past the fundamental question of what blockchain was really designed to do. I've long been worried about a lack of critical thinking around blockchain and the activity it's inspired. If you want to develop blockchain applications you only need to know what blockchain does, and not how it does it.

So I've written a report that explains how the blockchain works. It examines the founding principles of blockchain, describes its properties, and dispels common myths about its powers. The explanation below is an abridged excerpt from the report.


Blockchain is an algorithm and distributed data structure for managing electronic cash without a central administrator among people who know nothing about one another. Originally designed for the crypto-currency Bitcoin, the blockchain architecture was driven by a radical rejection of at (government-guaranteed) money and bank-controlled payments.

Blockchain is a special instance of Distributed Ledger Technologies (DLTs), almost all of which have emerged in Bitcoin's wake.


Blockchain is a Distributed Ledger Technology (DLT) that was invented to support the Bitcoin cryptocurrency. Bitcoin was motivated by an extreme rejection of government-guaranteed money and bank-controlled payments. The developer of Bitcoin, Satoshi Nakamoto envisioned people spending money without friction, intermediaries, regulation or the need to know or trust other parties.

Technically, the original blockchain is separable from Bitcoin, but this report will show that the blockchain design is so specific to Bitcoin that it's not a good fit for much else.

The central problem in electronic cash is Double Spend. Because pure electronic money is just data, nothing stops a currency holder from trying to spend it twice. Blockchain solves the Double Spend problem without a digital reserve fund or similar form of umpire.

Blockchain monitors and verifies Bitcoin transactions by calling upon a decentralized network of volunteer-run nodes to, in effect, vote on the order in which transactions occur. The network's algorithm ensures that each transaction is unique.

Several thousand nodes make up the Bitcoin network. Once a majority of nodes reaches consensus that all transactions in the recent past are unique (that is, not double spent), they are cryptographically sealed into a block. Each new block is linked to previously sealed blocks to create a chain of accepted history, thereby preserving a verified record of every spend.

The Bitcoin blockchain's functionality and security results from the network of thousands of nodes agreeing on the order of transactions. The diffuse nature of the network ensures transactions and balances are recorded without bias and are resistant to attack by even a relatively large number of bad actors. In fact, the record of transactions and balances remains secure as long as a simple majority (51 percent) of nodes remains independent. Thus, the integrity of the blockchain requires a great many participants.

One of the Bitcoin blockchain's most innovative aspects is how it incentivizes nodes to participate in the intensive consensus-building process by randomly rewarding one node with a fixed bounty (currently 12.5 BTC) every time a new block is settled and committed to the chain. This accumulation of Bitcoin in exchange for participation is called "mining" and is how new currency is added to the total system afloat.

Posted by

Thomas Prendergast

Original article is here: http://www.zdnet.com/article/blockchain-explained-in-plain-english/


Posted in News | Tagged , , , | Leave a comment