November 21st, 2018

Have you ever wanted to write code on a tablet in a Tesla? I have.

Maybe not the most common problem, but since I want to work on this page, it would be nice to be able to edit some javascript.

But getting Javascript into your WordPress page is not something WordPress does nicely by default.  It does have some nice plugins like Advanced Custom Fields which lets you put fields into your WP posts so that you can render them later in templates.

So, essentially, it has a decent HTML editor.  But if you are like me, and you want to play with Javascript on your blog pages, then perhaps this plugin is right for you.

The way I use it is:

  1. Install Advanced Custom Fields if you haven’t already
  2. Install the acf-javascript plugin
  3. Add an ACF Javascript to my WP Posts called “code”
  4. In my WP Template put <script><?php the_field(‘code’); ?></script>

That is all.  This will enable you to write code like this:

Tada:

Posted In:

Uncategorised

November 21st, 2018

ABOUT THE AUTHOR:
Please excuse my lack of attention to spell checking and grammar. I was probably busy thinking about better variable names. I am a Model 3 owner and lover and TSLA long only ever looking to increase position as the exponential growth TSLA has seen has not caught up to current stock prices. Sending a dumb tweet is easy. Building a Gigafactory are not. (See what I mean about the grammar?) Place your bets accordingly.