User : depiction

Title User Language Tags Description Date
WordPress: Print Current Post Categories Hierarchically for Custom Taxonomies depiction PHP

If you create a custom taxonomy there is no real easy way to print out the categories in client format. This code will print out all taxonomies a current post is associated with in a hierarchical unordered list.

April 20
WordPress and Gravity Forms: Add Placeholder Text to Fields depiction PHP

Place the following code in your theme's functions.php file to enable placeholder text for individual fields.

March 30
WordPress: Search Posts by Custom Post Type depiction PHP

Add the ability to search posts by custom post types.

March 27
Move Page Elements in Code Based on Browser Width depiction jQuery

When building responsive sites, you may find the need to move elements on the page around. Instead of creating multiple instances and toggling them on/off, move the entire divs using jQuery. When the browser width increases again, move it back to the original spot.

March 7
WordPress: Store dynamic_sidebar in a variable depiction PHP

Store dynamic_sidebar in a variable using PHP's object buffering control.

February 13
WordPress is_child() and is_ancestor() depiction PHP

Put the following in your functions.php file:

February 5
Wordpress: Deregister All in One Event Calendar CSS depiction PHP

Deregister All in One Event Calendar CSS so it's not on every page. Afterwards, add the CSS files directly to the calendar pages. This way they are only loaded when needed.

December 12
WordPress: Restrict Uploads folder access to logged in users depiction PHP

You might have some sections of your WordPress site that are only accessible for your WordPress user. Pretty easy to protect the page or post in WordPress for only the registered user but what about the attachments of the post/page (files, images)?

They won’t be protected by default, this means if a request is made directly to the file it can be accessed without any password. There is potentially the solution where you protect the files in a directory with htaccess password, but do you really want to manage new set of username and password outside or WordPress? Not really.

Here is the solution, use htaccess to check if a user is logged in the WordPress site when accessing the files area, if not then redirect to the WordPress login page. Here is the new .htaccess:

(These are the 3 new lines:) RewriteCond %{REQUESTURI} ^.uploads/. RewriteCond %{HTTPCOOKIE} !^.wordpressloggedin.$ [NC] RewriteRule . /wp-login.php?redirectto=%{REQUESTURI} [R,L]

To prevent WordPress from overwriting this later, CHMOD the .htaccess file to 444.

November 14
WordPress: Execute shortcode in custom field depiction PHP

This snippet will enable you to add shortcode to a wordpress custom field. Normally wordpress does not run shortcodes that you put into a custom field. Just put this code into whatever page you are displaying the results of the shortcode, and change the 'yourcustomfield_here' to the name of your custom field.

October 30
WordPress Custom Post Type Pagination depiction PHP

Important: In WordPress, a page name and custom post type can't have the same name. If the below loop doesn't work, check to make sure they are different! Also, this assumes WP Page-Navi is installed and active.

June 6, 2012
htaccess Caching depiction Apache

Cache files via htacess

April 25, 2012
BigCommerce: Change Border on Product Carousel Thumbnails depiction JavaScript

Add this to Panels/ProductDetails.html for the on-page carousel. For the lightbox, edit the existing code in productimage.html

October 27, 2011
Facebook iFrame Auto Height depiction JavaScript September 10, 2011
VB 301 Redirect depiction Visual Basic August 3, 2011
.htaccess Rewrite Rule with 301 redirect depiction Other June 25, 2011