Quantcast
Channel: Snippets – WPcustoms
Browsing all 22 articles
Browse latest View live

Restrict content to logged in users shortcode

This function creates a shortcode [member] which limits access on your site. Content wrapped in that shortcode is only visible for logged in users. Everybody else gets a message that this content is...

View Article



Redirect to custom url on failed login attempt

If a users login fails you can redirect to a custom page - i.e. an error page where you can show a registration form or give further tips why the login failed. Reset password etc. WPcustoms

View Article

Add custom RSS Feed to dashboard

This function removes the default WordPress feeds. The second function adds your custom feed url to the admin dashboard. Customize as required. WPcustoms

View Article

wp-admin: Rename ‘Post’ to ‘Article’

Some sites require to rename the Posts menu item to something different. This snippet gets that part done. Adjust the 'Article' text to anything you want your default posts to be named. WPcustoms

View Article

automatically add custom meta field values to posts

Auto-add custom meta field values with this function to all posts. This can be extended as required and i.e. add the authors nickname as a custom meta field. Options are endless and this gives you a...

View Article


Mark long comment URLs as spam

If a comment author URL is longer than 50 letters WordPress automatically marks it as spam with this short function. WPcustoms

View Article

Force SSL on custom post types

This snippet tells WordPress to use a SSL connection if a single page from custom post types is visited (in this example, movies and books). Adjust as required and check out the codex for...

View Article

Add welcome message to wp-login

This function inserts custom html below the logo on your wp-admin\ wp-login.php site. Add any html codes your project requires. WPcustoms

View Article


List download categories with EDD

If you are using EasyDigitalDownloads plugin you may want to build a template which lists all download categories. This function prints an ul-list for each category you've set in your EDD downloads....

View Article


Add download category and tag to post class

These two functions will add the download category and the download tag slug to the post_class. A good helper for custom css settings if a download item has a specific category like 'featured' or...

View Article

Check if email is valid

$email = 'testemail@gmail.com'; // email address which we are verifying if ( is_email( $email ) ) {       echo 'valid email.'; }else {       echo 'not a valid email'; }   WPcustoms

View Article

Modify “Category:” from the_archive_title

This function jumps into the hook the_archive_title to help you to modify the default output from archive pages titles WPcustoms

View Article

Show current child category in template

This function displays the post's current child category name. WPcustoms

View Article


Randomize your posts

Add this code snippet to your functions.php file. It jumps into the pre_get_posts hook and add the argument "orderby=rand" to the main queries. This way your posts get randomized in its order. Feel...

View Article

Create new image sizes for custom post types

By default WordPress creates three images sizes for every picture uploaded to your media library. If you want to create a new size for custom post types you can copy this code to your functions file....

View Article


Get theme info from style.css

If you want to show theme infos in your template you can grab them with these codes. WPcustoms

View Article

Force a minimum password length at checkout

Force an 8 letter minimum password length for easy digital download customer signups WPcustoms

View Article


Function to add a HOME link to your primary navigation

This function creates a custom link in your primary navigation. You can modify it and add more links or insert any other html to your menus WPcustoms

View Article

How to display current post taxonomies and terms

display all the taxonomies of the current post with attached terms WPcustoms

View Article

Require Minimum Comment Length

Paste this code into your WordPress functions.php file to require a minimum comment length. Adjust the '20' to set the required characters. WPcustoms

View Article
Browsing all 22 articles
Browse latest View live




Latest Images