How to add crypto widget to pages & posts?

I am doing an articles series on cryptocurrency and want to be able to add each crypto’s ticker from coinmarketcap.com

This is the embed code:

<script type="text/javascript" src="https://files.coinmarketcap.com/static/widget/currency.js"></script>
<div class="coinmarketcap-currency-widget" data-currencyid="145" data-base="USD"  data-secondary="BTC"></div>

But I can’t seem to figure out how to post it on various pages & posts to get it to populate properly?

Hello There,

Thanks for writing in! If you want to add the code into the page or post, please edit the page or post in Cornerstone and insert a Raw Content element. You can place the code inside the element and it should be able to display on the page or post.

Hope this helps. Please let us know how it goes.

Yeah that’s not really the solution because when I did that it deleted all of the content I added to that post and if I try to add all of the info & images like I do in a post, it just doesn’t format right.

Isn’t there any way I can insert that code into an actual post somehow?

This Scripts N Styles plugin was the correction solution it seems.

Hi

The recommended solution to add the Script is to use the wp_head hook and add the script to the head section of the page. You will need to install the Child Theme and add the code below to the functions.php file:

add_action('wp_head', 'head_information', 9999);

function head_information () { ?>
<script type="text/javascript" src="https://files.coinmarketcap.com/static/widget/currency.js"></script>
<?php }

Then, go to the page in question and use the Content Area element and add the code below there:

<div class="coinmarketcap-currency-widget" data-currencyid="145" data-base="USD"  data-secondary="BTC"></div>

For more information about the best practices and actions/filters in our theme read the respective articles I linked.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.