functions.php


Add Google Analytics to Functions.php in WordPress   Recently updated !

The following code will add Google analytics tracking code to your WordPress site’s header. Simply replace “UA-000000000-1” with your analytis UA tracking code and insert the snippet into functions.php.


Adding Jquery Code to WordPress

For this example we are going to use a script from a sticky menu First, add your script to a .js file located in your theme and make sure you wrap the code with the first and last lines:

Next, add the following to your functions.php file

You […]


Fix http and Thumbnail Error on Image Upload

A client was having issues with her image uploads http error and thumbnails not generating. Smaller images would generate the thumbnail just fine however larger images would upload but fail to generate thumbnails. After uploads the site was also showing an “http” error. After doing some searching I found this […]


Character limit

The following function will create a custom function to create a unique character limit excerpt for the post. Add the following to functions.php:

Add the following to the page template to get the function to show:


Limit Search Results to Blog Posts Only

The following snippet will limit search results to display blog posts only on your search results page. Copy and paste the following into functions.php

Source: http://www.wpbeginner.com/wp-tutorials/how-to-exclude-pages-from-wordpress-search-results/