bookmark_borderWhere Do I Put This Code?


CSS code will typically look something like this:

body .gform_wrapper { border:1px solid red }

In most cases, custom CSS should be pasted at the bottom of your theme’s style.css file. Your theme may have a custom.css. If so, pasting your custom styles at the very end of the file is preferable. Generally, when a theme includes any type of file named custom it indicates that this file should be used for custom code specific to the file type.


Javascript code will typically look something like this:

jQuery(document).ready(function($) {
    $('.gfield_checkbox input').click(function(){
        var is_checked = $(this).is(':checked');
        var parent = $(this).parent('li');
        } else {

Some theme’s will provide an init.js or, even better, a custom.js file. If so, pasting the custom Javascript in either of these files would be ideal. If neither is present, you can wrap your Javascript code in a <script> block and paste the code in your theme’s header.php file below the wp_head() function call.

<script type="text/javascript">
    jQuery(document).ready(function($) {

        // custom code


Additional Information on using JavaScript with WordPress can be found here:


PHP code will typically look something like this:

function gform_add_post_format($entry) {

    $post_id = rgar($entry, 'post_id');


    wp_set_object_terms($post_id, 'chat', 'post_format');


PHP snippets will almost always be pasted in your theme’s functions.php file. A few things to be aware of when adding PHP snippets.

  1. Your functions.php will already have an opening <?php tag. If the snippet you are copying also has an opening PHP tag, be sure to remove it before pasting it into your functions.php file.
  2. If the PHP snippet you are copying has opening and closing PHP tags inside the code itself, do not remove these. This simply means that the code is exiting “PHP mode” to output content directly to the screen.