Working with BBS Network Data - WordPress Plugin Tutorial - Part 1

Jul 14, 2022 10:03 AM

In this tutorial we are going to create a simple WordPress plugin that extracts a feed of posts from the blockchain data and displays it on a page. This is similar to an RSS feed or displaying a Facebook or Twitter feed on a website. 

Table of contents

Related stories

3. Display the BBS post titles on a page

4. Add BBS post content

5. Put it all together

About the tutorial

The tutorial will be broken into several parts to make it easier to follow instead of in one big chunk. I will add a table of contents to the top of each part to make it easier to navigate the series.

It will help if you have some knowledge of WordPress development but it's not necessary. You can find plenty of good beginner resources for WordPress online if you want to dig deeper.

You will need access to a WordPress environment, preferably a sandbox or development setup.  The plugin will work just fine on a fresh install with the standard theme or with any other theme. 

The BBS post editor is a bit rough so I will include screenshots of the code sections to make it a bit more readable. For convenience I will also include the code chunks but for learning, it's actually good to type in the code yourself rather than copy/paste.

What will the plugin do?

We are going to create a very simple plugin. It will display a list of BBS Network posts for a given board on a WordPress page using a shortcode. 

For the tutorial we will doing all the coding in one file. This is not the best way for a production-ready plugin but it helps simplify things for the tutorial. At the end of the tutorial you will have a minimum viable product that you can develop further.

If you develop the plugin further, a link back to this tutorial would be much appreciated 😄.

What does a post look like in the blockchain?

The following is an example of what a post looks like in the blockchain. The format is json which is a very commonly used type of data format that is human-readable and consists  of attribute–value pairs and arrays.

In the example below, we can see some metadata  about the post like who created it and when . Other important metadata are the token or board that it was created on and the id of the post as well as the channel/category.

We also have the post content which is in the form of blocks. Those blocks are what types of content you put into the editor when you create a post. Blocks can be paragraphs, images, video and other types.

Example of a post.create

The post.create type is the data type we will be using in the plugin. You can see more examples in the bloks.io blockchain explorer for the account deweb.eosn. There is a lot of data in a transaction so search in the page for 'post.create'.

Plugin setup

First we will create a stub for the plugin and activate it.

1. Create a folder for the plugin called bbs-network-feed in wp-content/plugins

2. Create a file in the bbs-network-feed folder called bbs-network-feed.php

3. Add the info section for the plugin to your bbs-network-feed.php file. Feel free to change the author and other details but it is best to keep the plugin values the same for reference through the tutorial.

4. Activate the plugin in WP Admin

That's it for part 1. You have a WordPress plugin that does absolutely nothing ðŸ˜‚. The next part will add some admin functionality to the plugin.

The code for part 1

11
Comments
anonymous profile image
Powered by RoundtableAn AI/DeFi-powered Enterprise Media Operating System. Learn more at Roundtable.io.© Roundtable 2026. By using this site you agree to the Terms of Use and Privacy Policy