Tuesday, 28 August 2018

How to make a crypto WordPress widget using the CoinMarketCap API


Have you ever wanted to know how to build your own WordPress widget? Have you ever wanted to know how you can use (consume) a third-party API from within your WordPress theme/plugin? Did you answer “yes” to at least one of the questions? If you did, the keep reading because you’re actually learn how to do both. Start by creating an empty plugin inside its own folder, to house our code and files. Let’s call our project “ci-crypto-widget“, so create a folder with that name and a .php file with the same name inside it.
<?php
/*
Plugin Name: CI Crypto Widget
Plugin URI: https://www.cssigniter.com/
Description: Provides a widget that consumes the CoinMarketCap API
Version: 1.0
Author: Anastis Sourgoutsidis
Author URI: https://www.cssigniter.com/author/anastis/
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Creating a Widget
Assuming you (as a user) know what widgets are, then next big thing that you need to know about them (as a programmer) is that widgets are just specializations (subclasses) of the WP_Widget class. Widgets typically override 4 methods:
__construct() – It’s required to call the parent’s
Source: https://managewp.org/articles/17798/how-to-make-a-crypto-wordpress-widget-using-the-coinmarketcap-api



source https://williechiu40.wordpress.com/2018/08/28/how-to-make-a-crypto-wordpress-widget-using-the-coinmarketcap-api/

No comments:

Post a Comment