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:

November 21st, 2018

Posted In: Uncategorised

Did you know that the 3 cars with the lowest probability of injury in a vehicle accident are all made by Tesla?
Other Benefits Include
Did I mention they come equipped to drive themselves which will continually improve with future software updates?

See you at the SuperChargers!