Introduction to course series “WordPress tips, tricks and hacks”
Before starting with the course “WordPress tips, tricks and hacks” I would like to thank you for choosing me to train you on this topic.
Why I made this course?
When I am on the internet surfing through different awesome looking websites, most of the time I come across a feature on a website, and then I just start thinking : How can I get this on my WordPress website as well. And if you are a crazy wordpress developer then I bet you have experienced the very same feeling too. There are times when you want a feature which you just saw, but do not know where to look for the tricks, or even what tricks to look for. In this tutorial I will be sharing a few of such WordPress Tips, Tricks, and Hacks that I found very useful for myself and I can assure that you will definitely find it useful too. And most importantly it is fun. That’s why I made this course, to have some fun.
I believe that this course is for advanced wordpress developers who already have knowledge of wordpress. So, if you do not have basic knowledge of wordpress then I would strongly suggest you to learn the basics and return here.
Till today I am having 4 courses on my youtube channel and in the BG web agency website training library and this is going to be the fifth course that I will be doing. And I want to say that, I am most excited about this course as compared to the other four courses that I have here. Because this course has got everything an advanced wordpress developer needs to learn.
In every video tutorial, I will be sharing you few wordpress tips, tricks and hacks. And to show you how the trick works, I will be using some code. You can download the source code for all the videos from the official website for BG web agency. And if you have any doubt or questions or complaints, you can post them in the comment section for the youtube video or on my website.
Having said that, I hope you are now fully excited about this new course on “WordPress Tips, Tricks and Hacks”.
Adding sections and fields to user profile page
The user profile page is the page in the back end of a wordpress installation that helps you manage your wordpress users which includes managing admins, editors, subscribers,contributors and authors. WordPress comes out of the box with some fields that you can manage. Like the name, email and website details and etc.
But what if you want to add more fields to this form? For example say that when a user is added to your website you want the user to mention it’s designation also. Or maybe a field to mention date of birth of the user.
Well, in this tutorial I am going to show you how to do this with the help of a demo.
Download exercise files for lecture 2 :
the filter Hook
In this tutorial I am going to show you how to use a filter called “the_filter”. “the_filter” is as the name says a filter hook which allows you to filter anything in wordpress. In my case here, I will be filtering the content on my wordpress website.
Let me show you that with the help of a demo.
Download exercise files for lecture 3 :
Insert page or post programmatically
I guess you already know how to create a post or page by using the admin area of your wordpress website. In this tutorial I am going to show you how to create a post or a page programmatically. Now, you might be thinking why would you need to do that. WordPress already have a nice admin section to create posts and pages then what is the need of adding posts and pages from somewhere else. The reason is, maybe you have a scenario where you do not want a particular user to access your wordpress backend. So, what you can do is create a form in the front end of your website and through that form you can allow the user to insert a post or page programmatically.
To do this, we are going to use a function called wp_insert_post(). To demonstrate how the function works, I will be showing you a simple example to create posts and I expect you to take this knowledge further and implement with forms or anywhere you want for your project.
So, let’s jump to the demo.
Download exercise files for lecture 4 :
Display random posts
WordPress by default shows you the posts in reverse chronological order, which means it shows you the latest posts on the top and the older ones later.
But have you ever wanted your website to have this cool feature to display random posts every time your visitor arrives? So that each time the visitor refresh the page, it will deliver a new post. Well in this tutorial I am going to show you how to do that.
Let’s jump to the demo.
Download exercise files for lecture 5 :
Image thumbnails in wordpress
In this tutorial I am going to teach you how to create custom thumbnail sizes and then apply it to the featured images of your wordpress posts.
Download exercise files for lecture 6 :
Admin notices in wordpress
In most of my wordpress themes, I always display some guidelines or rules on backend of my wordpress website. What I do is, I display a message box right on the top of every pages in the backend. So, in this tutorial I am going to show you how to display notices on each page of your wordpress backend and then I will also show you how to write conditional statements so that the notices shows only on particular pages and not appear on each and every page.
In order to display the notices we will be using an action hook called all_admin_notices.
Let’s jump to the demo.
Download exercise files for lecture 7 :
PART 8 :
Display Relative Dates in WordPress
Have you ever wondered how to display relative dates on your wordpress website? Actually it is pretty easy.
All You would need to do is download a plugin called WP-Relative Date.
Once you have downloaded and activated the plugin, the date and time for posts on your wordpress website is automatically going to switch to relative mode.
In case you want to display the relative date or time anywhere inside of your post or in your code then you can use the shortcodes:
For relative date:
[relativedate date_format="jS F Y" ago_only="false"]
For relative time:
[relativetime time_format="H:i" ago_only="false"]