Allow Multiple User Emails
Ever need to allow your users to have non-unique email addresses? (i.e. two user accounts with the same email address)
Here’s the function:
Ever need to allow your users to have non-unique email addresses? (i.e. two user accounts with the same email address)
Here’s the function:
In the latest versions of WordPress, the number of columns showing in the dashboard are automatically generated based on your screen size. That works for many situations, but you may want to control the number of columns.
For example, if you only have 1 or 2 items showing on your dashboard, it looks awkward on a large screen. So, here is a function that allows you to control the default and max number of columns:
By default, WordPress strips all HTML tags from excerpts. To allow them, simply replace the filter that creates the excerpt from your content.
First, copy the default excerpt filter from wp-includes/formatting.php:
By changing the strip_tags parameters, you can allow whatever tags you want:
Also be sure to change the name of the function. Copy this to your functions.php file.
Then, replace the default filter with your new one in functions.php:
Curious as to what you have/would use this function for?
Since it only detects browser agent and disregards size, what would you show/hide only for mobile viewers?
Use this function to replace “Howdy, $username” with “Welcome, $username”:
Thanks to Thoriq Firdaus! Replayed from: http://www.hongkiat.com/blog/wordpress-howdy-customized/, where you’ll also find a clever function to customize the message for special occasions.
When saving custom fields from a custom metabox, if the value is empty, usually the custom field is deleted. This is good, as it keeps from having lots of empty entries in the database.
However, it means that when you update from the “Quick Edit” menu, since your custom fields are not in the form, they will disappear. Not so good.
Here’s the fix. Add this to your save function for the metabox:
So, your save function should look something like this:
WordPress automatically deletes items you have trashed (posts, pages, etc) after 30 days. You can set this to fewer days to keep them from building up.
Put this in your wp-config.php file:
To keep your database from bloating with endless revisions, you can limit the number that’s stored for each post.
Put this in your config.php file. (The second parameter is the number of revisions to keep.)
When you have layout areas with specific sizes, you need to limit the amount of text that appears. Rather than modify the excerpt size for the whole site, you can use this function:
Then, call it in your template (from inside the loop) like this:
If you are creating a child theme, you have two choices that load faster than using @import in your child style.css file.
1. You can add the parent style link to the child header.php, just above your normal css link.
2. You can add this to your functions.php file.