When building your own theme in WordPress, using Jquery with $ might cause issues. To fix this wrap your code in this:
Remove container and UL on WordPress nav menu
Sometimes you might want to programatically include other things in your menu in WordPress and to do that you will want to control the UL tags so you can insert other LI items within it.
The code below will allow you to spit out ONLY the LI tags from a WordPress Nav Menu, you will have to wrap it in UL yourself so you can add extra LI.
Really simple CSS page load fade-in
This is a really neat, lightweight and simple was to add a fade in onto your page when it loads.
Remove ‘category’, ‘archive’, etc from get_the_archive_title()
Remove the prepended ‘Category:’ or ‘Archive:’ when trying to echo the name of the archive in WordPress.
Loop through Taxonomies and list posts underneath
In my WordPress site, I had a need to list all taxonomies and underneath them, their related custom post types.
To do this, I used this code below. Obviously replace “custom_taxomy” with your taxonomy name and “custom_post_type” with your post type name.
Really simple loading fade-in effect for your website
Sometimes it can look good to gradually fade in a page on website load. It gives a page a nicer feel.
To add a simple fade-in when the page loads, PURE CSS (No Javascript) – add this to your CSS.
Add inline JS to WordPress footer
Adding JS to WordPress can be done in two ways. The first way is to enqueue the JS file.
The second way can be done by adding inline JS via a hook in functions.php – this is most likely used to initialize a script that is enqueued or add Google Tracking codes, Facebook pixels etc.
Change excerpt size in WordPress
The default WordPress excerpt character length can be changed by inserting the below snippet into your functions.php.
Change 20 to however many characters you want to limit your excerpt to.
Read More
How to use icon in pseudo CSS element using Font Awesome Pro
Implement FontAwesome Pro in CSS using Pseudo elements, it comes in handy when creating drop down menus, etc.
Change the font weight based on the library you are using.
Eg if you are using Font Awesome Light, use weight of 300.
Remove Yoast SEO WordPress titles and descriptions in MySQL FAST
I needed to delete all custom titles and descriptions fast from Yoast plugin for WordPress.
To do it, I used these SQL queries in MySQL