If you’ve tried different plugins and still having problems embedding code in WordPress, you might want to try this code:
One of the benefits of using Githubs Gists, is the fact other programmers can come along and comment on your code.
Not to mention the fact it displays your PHP properly without messing up your site.
If you’ve made a mistake or your code isn’t written using best practices, Github users can come along and help you improve your code.
Other benefits of using Github are when programmers fork your code and modify it to build something else which is useful.
1. Someone else can embed your code and you can change it or add to it remotely and its updated everywhere its embedded.
3. Links back to your account where you have other code snippets.
4. Handles many types of code.
1. If the Github servers are down, so is your code.
2. Some people copy it without using the view raw link and then paste it into the WordPress theme editor. This can change the apostrophes in the code causing an error. Its better to ask then to copy from the view raw link and paste into the file using a code editor.
3. The code is hosted remotely and not easy to backup.
4. You are also linking back to Github every time you embed code. Can add no follow to avoid this.
5. Paste the embed script into your text editor and then return to visual editor and back again can strip out the embed script losing your code.
6. Doesn’t work well when including HTML with PHP code.
How To Embed Github Gists In WordPress
1. Click on This Gist link above
2. Copy from the Embed This Gist option
3. Paste the one line of script into your text editor and click save
4. Click the View Post button above your WordPress editor to see the result.
More On Github Gists & Embedding Code in WordPress
And You. How do you embed code in WordPress?Subscribe for Free & Premium Genesis Tutorials