Over 50 Ready-To-Use WordPress Code Snippets, Tricks & Hacks
3.8 (13 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
315 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Over 50 Ready-To-Use WordPress Code Snippets, Tricks & Hacks to your Wishlist.

Add to Wishlist

Over 50 Ready-To-Use WordPress Code Snippets, Tricks & Hacks

Save time and effort coding WordPress themes & plugins with these already coded programs that come with explanations.
3.8 (13 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
315 students enrolled
Created by Bruce Chamoff
Last updated 8/2016
English
Current price: $10 Original price: $40 Discount: 75% off
1 day left at this price!
30-Day Money-Back Guarantee
Includes:
  • 4 hours on-demand video
  • 47 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • save time by adding existing WordPress code and API snippets into your plugins and themes
  • manipulate content from posts and pages
  • create your own custom post types complete with their own taxonomies and custom fields
  • displaying random posts on the fly
  • white label WordPress and replace the WP logo and replace it with your own
  • change the popular plugin Contact Form 7 and make it do amazing things that are not available out of the box
View Curriculum
Requirements
  • Some PHP
  • Some WordPress development skills
Description

This course helps any WordPress designer and developer save time by copying and pasting WordPress code into any theme or plugin. Video lectures explain how to customize the code to make your their own.

This course will constantly evolve with new "code snippets" on everything from shortcodes, custom post types, and manipulation of popular plugins including Contact Form 7.

This course is best for those who already know the basics of PHP and some WordPress development skills, but if you are just getting into WordPress theme or plugin development, the code resources will help you add more powerful functionality to your already-existing code.

In this WordPress cookbook course, code recipes are already available for:

  • post and page content manipulation
  • automatically creating new menu locations in themes
  • custom post types
  • displaying random posts on the fly
  • manipulation of the contact form 7 plugin
  • adding a popup to your home page
  • generating a tag cloud from your posts or plugins
  • and more
Who is the target audience?
  • PHP developers
  • Both intermediate and advanced WordPress developers who would like to save time coding.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 56 Lectures Collapse All 56 Lectures 03:58:55
+
Introduction and Green Screen Videos From The Instructor
2 Lectures 05:14

I introduce the class and tell you how it is structured. Remember, almost every video has its own code recipe in the Resources section for that lecture.

Preview 03:07

A lot of students ask me how to add the code snippets from this course, so in this green screen video, I answer it. The uneven collars are intentional. Come on! This is a green screen video. We have to have fun and my uneven collar just keeps it from getting boring. Can you watch this without laughing at my collar?

Preview 02:07
+
General WordPress Code Snippets
6 Lectures 23:05

This code recipe will give you a way to add the date using simple PHP, but in a WordPress shortcode.

Get a Flex Date
01:39

A WordPress multisite can save you work creating multiple websites and database space, but some people ask me how to create one. I show you in this video. Open up the script in the resources section and add the code to your wp-config file. Make sure to back it up first.

Convert Any WordPress Site to a WP Multisite
04:26

Some themes are very limited with the number of menu locations they offer. Maybe you want your theme to have a lot of theme locations. The code in this recipe creates 10 new locations for you. You can also create a plugin out of this to extend any theme you purchase or download from the WP themes repository.

In this video, I also show you how to place those menu locations anywhere in your theme.

Create 10 New Menu Locations When Building A Website
07:15

I am often asked how to make a custom-developed theme compatible with the WooCommerce plugin. Maybe you want to add ecommerce to your theme and after you add the WooCommerce plugin, your theme needs to support it. This recipe shows does that for you.

Convert Any Theme To Be WooCommerce Compatible
02:23

Automatically Send Email Notification Everytime a Post Is Saved
03:47

A lot of people do not know what Woocommerce comes with its own set of hooks to change it in any way. Sometimes, you may want to change the short description of a product. I provide you the script on how to do just that. Watch the video for an explanation on how I did that for one particular client.

Woocommerce - Changing the Short Description for Products
03:35
+
Code Snippets For User management, User Interactions and More
6 Lectures 27:23

This is a funny snippet. You can drive your admins crazy with this one by changing the name of all the user roles. How about renaming the administrator role to "Supreme Honcho"?

Fun Snippet: Rename All Of The User Roles
07:32

Sometimes, you just want to log in as another user. That can be done with this code recipe. All you need is the user ID of the user and simply pop it into the function as a parameter. Run the admin back end and the user will automatically be logged in, so you can see information about that user.

Automatically Log In Any User
03:18

Maybe you want to create a mailing list of all your users. This code recipe will do just that.I also show you in this video how to display user's names in the same recipe.

Show a list of all users by name or email addresses
03:19

I love this recipe. How would you like a quick code recipe to display the gravatars of your writing team? This code will do that. Think of it as being similar to your Facebook like boxes. I also show you how to change the gravatar size in this video.

Display Gravatars of All Users
01:23

Sometimes, a website looks nicer and more professional when it greets a user. This code will do just that for users after they log in.

Greet Users On Any Post or Page with a Simple Shortcode
04:37

When we enter a new page or post, there is a generic placeholder that says "Enter Title Here". What if you wanted to customize it for a custom post type. This script lets you do that.

Customize the Default "Enter Title Here" Placeholder
07:14
+
Admin / Administrative
11 Lectures 38:23

This is a cool little script people who like to see everything decorated with different colors. In the back end admin, you can change the colors of posts depending different on their status (published, pending, etc). Why would we want to do this. Sometimes, you may not want to click the status links at the top. This way is quicker, much quicker. By changing the colors of the links depending on the status, you can quickly see the status without extra clicks.

Admin: Quickly See The Status of Any Post By Changing Its Color (published, etc)
03:28

On some websites, we may want to change the WordPress logo on the login form for these reasons:
  • We are tired of looking at the logo
  • We want to add our own logo for branding purposes or white labeling.

With this script, you can change the logo from any URL or image in your WordPress media library.

Change the WordPress Logo on the Admin Login Form
04:07

Maybe you have a post that needs people to log in before reading it, or a private post. Just load up this recipe and enter the shortcode in the video and your content will be protected.

Preview 01:50

Add links to your Facebook page, Twitter profile, etc. This code recipe works great if you have a lot of people logging into your WordPress administrative back end.

Preview 04:53

Show admin users who have access to the back end that you cared enough to greet them in the back end. This recipe will display a welcome message in a custom dashboard widget.

Greet Administrative Users As Soon As They Log In Displaying A Dashboard Widget
04:05

Sometimes, you just do not want a specific blogger to have access to blog. Maybe he abuse his privileges. With this code recipe, you can remove the links to the Posts and Pages as well as Media.

Remove Blogging Rights From One Or More Bloggers
03:00

Sometimes, you may want to remove the WordPress logo from the admin bar, perhaps for white labeling. This recipe will do just that.

Remove WordPress Logo From Admin Bar For White Labeling
01:50

Sometimes, you just want to see what your home page looks like as a regular user, but you do NOT want to log out. This code will hide the admin bar from the front end while you are still logged in.

Hide The Admin Bar On The Front End
03:02

In the last video, we removed the WP logo. The WordPress logo is nice when you tell your clients that they are using WordPress, but maybe you want them to think the CMS was developed by you. This recipe will change the WordPress logo and let you add your own.

In this video, we replace the WordPress logo with the Superman logo.

Replace Admin Logo for White Labeling
02:53

Don't you hate it when the login form shakes back end forth just because you typed in the wrong password? Add this little recipe and prevent that from happening ever again.

Make the Admin Log Page Stop SHAKKKINNNNNNNGGGG! I Just Hate It When It Does!
03:02

Properly Adding Javascript and CSS to Any WordPress Theme or Plugin
06:13
+
Code Snippets To Create and Enhance Custom Post Types
6 Lectures 31:16

There are so many plugins that help developers create custom post types. Why should developers create their own? If you create a plugin or theme, you may want it to come with its own custom post type. WooCommerce comes with its own products post type. WP Job Manager comes with its own job listing post type. In this section, I give you the code recipes to create your own custom post types.

Why Do We Need Our Own Code For Custom Post Types?
00:56

Custom Post Types are separate types of posts that help admins create different types of content instead of just the regular "posts" that may be used as blog posts. What if you have a list of addresses or locations? Would you necessarily make them a post? Probably not. A custom post type solves this dilemna.

Simple Custom Post Type
07:01

Taxonomies are well-known among seasoned and veteran WordPress developers providing the ability to add categories and tags to posts. However, the normal "blog post" posts may have categories that simply do not work for your custom post type, so with this code, you can add your own taxonomies that are unique to your custom post type.

More Complex Locations Custom Post Type with Custom Taxonomies
08:14

Every post needs fields and custom post types can have their own fields. In this recipe, I provide the code to add custom fields to your custom post type.

Even More Complex Custom Post Type With Its Own Fields
10:34

Sometimes, you want to just insert a new post from as custom post type. Here is the code to do it.

Automatically Insert A Post From Any Custom Post Type
02:56

PROJECT: Create The Menu Items Custom Post Type
01:35
+
Recipes for the Contact Form 7 Plugin
5 Lectures 13:43

In Contact Form 7, sometimes adding all your custom fields can be a pain for long complex contact forms. This recipe will automate all of the fields being added to the email message body.

Contact Form 7: Automatically Add All Fields Before Sending Email
02:33

Sometimes, you just need to capture the IP address of the sender maybe for tracking purposes or just plain blocking of specific IP addresses. Contact Form 7 provides no way to do this, so we need to add some code to our plugins or themes. This recipe has the code you need.

Contact Form 7: Capture the Sender's IP Address and Include It in the Message
01:49

Suppose on your contact form you have different categories which the user can select in a drop-down menu control. Maybe you want to prevent specific categories from getting onto your website and you do not care about certain selections.


With this recipe, you can simply tell Contact Form 7 not to send emails based on specific data selected by the user. It is very useful for controlling form submissions.

Contact Form 7: Preventing Form Submissions Based On Certain Data
04:20

Contact Form 7: Dynamically Change The Recipient Based On Drop-Down Menu Values
03:52

I explain some of the code recipes in the Contact Form 7 section.

Preview 01:09
+
Quick Post Content Loops
5 Lectures 26:01

For websites that have a lot of blog posts, they can use this code for several benefits:

  • Show users a new post every time.
  • Maybe display different information for SEO purposes.
  • Random posts also look fresh and cool.

Use the code here to generate one with a shortcode.

Display a Random Post
04:22

With this recipe, you can display posts from any custom post type. The code example shows the custom post type for countries. In the video, I also touch upon another custom post type for rock bands and show you how to find the slug that needs to be plugged into the code.

Loop Through Custom Post Types
07:17

Sometimes, you just want a random post. Well, this recipe has the code for just that. This recipe shows code to display a random post for post, pages, and custom post types.

Display a Random Post For Any Post, Page, or Custom Post Type
04:42

Sometimes, you just want some quick code to loop through posts by a specific category. This recipe will do that for you. Watch this video on how to set that up.

Loop Through Posts, Pages, and Post Types by Category Name
05:21

Maybe you want to display posts by a specific author. This recipes calls for a new main ingredient. That is the user ID of the author. I show you how to enter it into the recipe in this video

Loop Through Posts By Specific Author ID
04:19
+
WordPress New Code Snippets Tricks (Part 1)
8 Lectures 41:45

This code snippet gives you a complete section to enter social media addresses like Facebook, Twitter, etc and shows you how to extend it to add your own. The form is added to the WordPress customizer.

Social Media Customizer Section
04:29

From the code snippet in the last video, we use this code to display the social media links in any template using WordPress' Theme Modification API.

Display Social Media Links From The Customizer Form Data
06:15

The Hello Dolly plugin comes with every WordPress installation, but a lot of people do not know what Hello Dolly actually is. It is a popular song from the 1930's made popular by musician Louie Armstrong, but using this code snippet, you can create a new plugin that works exactly like Hello Dolly, only using the song lyrics of your choice. How about replacing it with Rock-n-Roll by Led Zeppelin or Young, Wild and Free by Snoop Dog? The choice is up to you!

Change the Lyrics in the Hello Dolly Plugin
05:29

We can also change Hello Dolly to generate announcements on the back end. We can use this to display random announcements to other admins, clients, or WordPress blog writers.

Change Hello Dolly Plugin to Become a White Label Announcements Generator
07:14

Sometimes, we need an automated way of wishing our website visitors and customers that they have a nice holiday. Do it with this code snippet!

Display a Message On Popular Holidays at the Top of Any WordPress Site
03:29

RSS feeds are one of the most powerful, but under-utilized, internet marketing tools. NY Times has over 25 of them, so in this code snippet, I give you a plugin that I created which you can use that produces a shortcode for any blog post or page. We add the NY Times Real Estate and Sports feeds, but I show you how to add any RSS feed in the world!

RSS Feed For Anybody Else's Blog
07:09

We can add a tag cloud anywhere in our themes or plugins. This code snippet is ready to use and I show you in this video how to change its appearance using a simple PHP array.

Add A Tag Cloud Anywhere
04:24

I gave you the code in for the tag cloud in the last video, but in this video, I show you how to set it up as a shortcode. I also provide you with a complete plugin and show you how to add the shortcode to pages and posts.

Tag Cloud as a Shortcode
03:16
+
Create a Very Lightweight Popup Box On Your Home Page
3 Lectures 08:02

All popup boxes need styling, so I provide you the CSS needed to create a centered popup box. You can add this CSS to your existing styles.css file.

Start with the CSS
02:14

We want to add a new <DIV> to the top of your Body tag without touching any theme files, so we create this jQuery file that will be loaded up.

Add the jQuery file
03:40

We need to add this code to your functions.php file or your plugin file to call the wp_enqueue_script hook which is responsible for loading scripts and styles.

Add the wp_enqueue_script() hook to load the popup.
02:08
+
Working with Blog Posts
4 Lectures 24:03

Sometimes, you have blog posts that you want to delete, because they are too old. What you define as "too old" is up to you. That can be two months, two years, or even two days, but it does not matter, because with this video, you will learn how to delete blog posts of any age and keep your blog as clean as you would like. 

The code snippet here prevents the stress of having to delete each and every blog post separately or searching for the Move To Trash link.

Automatically Delete Old Blog Posts With A Quick Menu Link
07:55

This video starts the 3-part series on inserting blog posts from an external RSS feed. Have you ever wanted to insert a blog post from another RSS feed? Doing that is a great way to start a blog post that you can re-word later and get a quick blog post out. This code snippet is used on the Latest Blog Posts blog network that has over 2,000 blogs worldwide, so a reliable plugin to perform this function is important.


This code snippet is a complete plugin that can be installed and activated. I show you how to configure it in the video.

Import RSS Feed Items Into Your Own Blog Posts (importing Blog Posts Part 1)
08:58

This code snippet shows you how to automatically assign a category to any blog post that gets imported through the RSS feed.

This video does not have a resource, because it is part of the video Import RSS Feed Items Into Your Own Blog Posts (importing Blog Posts Part 1).

Set The Post Category After Inserting a Post (importing Blog Posts Part 2)
01:40

This code snippet shows you how to automatically attach a featured image to any blog post that gets imported through the RSS feed.


This video does not have a resource, because it is part of the video Import RSS Feed Items Into Your Own Blog Posts (importing Blog Posts Part 1).

Add a Featured Image After Inserting The Post (importing Blog Posts Part 3)
05:30
About the Instructor
Bruce Chamoff
4.1 Average rating
731 Reviews
19,840 Students
11 Courses
Web Developer of 20 Years and Songwriter of Over 40 Years

CEO of the Web Designer Mall, a one-stop shop for all web designers and web developers.

I have designed and developed over 1,000 websites in the past 20 years for companies of all sizes from small businesses to major Fortune 500 corporations. Being the owner of a prestigious online mall for web developers, I have programmed everything from WordPress to Drupal to Joomla to simple HTML5.

Involved in the WordPress Community. I am also a speaker at WordCamps in the United States. 

The Music, The Songwriting

I love writing, recording, and producing music, mainly my own originals. I play sax and piano and have over 150 songs. Yes, I should have gone for that record deal, but I still enjoy the process of making music!