WordPress is an excellent blogging platform, we know that already. However, when it comes to including custom codes, WordPress does not provide any native option. For that purpose, you will need custom code plugins. These plugins let you do everything including inserting codes into the posts, pages or the functions.php file, highlight code, add code to a specific location of your website etc.
In today’s post, I will discuss about the 5 most popular WordPress plugins for adding codes to your WordPress website. Let’s start with Hana Code Insert.
1. Hana Code Insert
If you are looking for a simple solution to add HTML, JavaScript or PHP code into your WordPress posts, Hana Code Insert could be one of your top choices. The plugin provides a really simple way to add PayPal donation buttons, AdSense code or any other custom code in your posts or pages.
Once you have installed and activated the plugin, go to Settings > Hana Code Insert from your website dashboard. On that page, you will find a textarea for the custom code. If you want to change the size of the textarea, you can do so by changing the columns and rows values from the ‘Settings’ section.
By default, you will get separate shortcodes for each code block you save. You can also create custom shortcode in the ‘Custom Short Code format’ section. And if you want to run PHP code, check the ‘Enable PHP Execution’ box.
In order to create a new code block, provide a title in the ‘New Entry Name’ field and paste the code in the textarea. Click ‘Create New Entry’ to save the code. You will find all of your saved codes in the ‘Edit Existing Entries’ section. To insert a code block, copy the shortcode and paste it into the page or post body.
2. Code Insert Manager
Code Insert Manager is an excellent free plugin for inserting HTML, CSS, JavaScript or PHP code blocks into the pages of your WordPress website. It is possible to add code into various sections of a page including header, footer, before and after the page and post content, after the post excerpt. You can also place the code into custom widgets or use custom shortcodes.
In order to add a new code block, go to Code Insert > Add New from your website dashboard. Provide a short description; choose the location for the code. If you select ‘Widget’ as the location, then you have to provide the widget title too.
If you are using multiple codes for a same location, then you can prioritize them. You will also find options to include or exclude the code in specific pages. ‘Hide from user’ lets you hide the code from specific types of visitors.
To view all of your saved codes, go to Code Insert > Inserts. You will find all the codes listed there. Hovering over a code block will reveal two additional options – Deactivate and Delete.
3. WP Code Highlight
This plugin does what it sounds like. It highlights the code inserted into your posts or pages. The highlighting process is as simple as adding <pre> before the code and </pre> after the code. You will also get a button which could be used to add these signs. As the plugin recognizes all the commonly used languages, you don’t have to declare the language name specifically.
After installing and activating the theme, go to the post editor. Switch to the ‘Text’ mode if you want to use the button. Once you are in the text mode, click the ‘WP-Code-Highlight’ button once to insert the <pre> tag and again to insert the </pre> tag. You will have to put your code between these two tags.
In order to change the plugin settings, go to Settings > WP Code Highlight from your website dashboard. From that page, you can disable the button, choose a different highlight theme for the codes, enable line numbers etc.
4. Easy Code Placement
Easy Code Placement is another excellent free plugin for inserting code into the posts or pages of your WordPress website. The plugin lets you insert the code into text widgets too. By using this plugin, you can easily create custom donation buttons or display custom content on the sidebar. It supports various types of codes including HTML, CSS, JavaScript, PHP, Flash, AdSense etc.
In order to add a new code block, go to Settings > Easy Code Placement from your website dashboard. Click ‘Add New Code’. In the next page, provide a name for the code. Don’t include any white space in the name. Otherwise, it will return an error. Then, provide your code in the ‘Code’ field. Set the status of the code and finally, click ‘Add’.
You will find all of your codes in the Settings > Easy Code Placement page. Each code will be accompanied by a shortcode and some options to activate or deactivate the code, alignment status, edit and delete links. To use any code, copy the shortcode and paste it into the post or page.
5. Code Snippets
Unlike other plugins of this list, Code Snippets does not allow you to add code blocks into the posts or pages. Rather, this plugin provides a simple and easy way of inserting code snippets in your WordPress website. A snippet is a small PHP code block that helps you to include additional features to WordPress.
While you had to include the code snippet into the functions.php file, Code Snippets saves you from that hassle. By using Code Snippets, you will get a graphical interface which will work exactly as if the snippets were included in your functions.php file. Additionally, you will find some useful options to manage your snippets.
Once you activate the plugin, it will create a new menu item titled ‘Snippets’ in your dashboard. To add a new snippet, go to Snippets > Add New. Provide a title for the snippet, then paste the code and provide a description about the snippet. Finally, click ‘Save Changes and Activate’ to activate the snippet instantly. Alternatively, you can just save the snippet and activate it later.
To view all of your snippets, go to Snippets > Manage. On that page, you will find all of your snippets listed. Hovering over any snippet will reveal links to deactivate, edit, export or delete the snippet.
Conclusion
I hope this post helped you in finding out the custom code plugin you are looking for. However, are you using any of them already? If yes, then please share your experience with us. Or if you think I have missed an obvious one here, let me know that too. I will be glad to take a look at your favorite plugin.
- How to Display WordPress Login Form in the Sidebar - April 17, 2015
- How to Show Posts from Certain Categories in WordPress SideBar - April 4, 2015
- 5 Best Custom Code Plugins for WordPress - March 10, 2015
Hi Foysal
I think you are great techy in wordpress. Am starts work in wordpress differently i need to work in wp-admin part. how to set categories for pages and i have differents users to set in wordpress user menu. May you help me for concepts
Thank you for sharing the details Foysal. I was just looking for this exactly and found this to be a great resource. Thank you so much again for sharing this information.
How to create a box to let other bloggers to embed my website.
I mean to say how to create a embed box with my link code in HTML