Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This function, when placed in a theme's 'functions.php' file will insert a custom id attribute into the '<li>' elements generated by a 'wp_nav_menu' function based on the title of the element. It will make a WordPress page or category into a hyphen s...
0
2425
posted 14 years ago by SFLWebDev
These two snippets together, the first in the .htaccess file, and the second in your PHP create an elegantly simple solution to arbitrary URLs with php. For a breakdown and example check out the link.
Don't want to follow the link, how about the q...
0
2924
posted 14 years ago by FatFolderDesigner
Function to get wordpress post/page slug to be used on for custom class etc
0
2867
posted 14 years ago by Farhan
- Mage 1.7* flag storeswitcher
- images/flags/flag_[storeview_name].png
0
1367
posted 14 years ago by WGenie
Create variable named PHP variables. Having dynamically named variables can be helpful when dealing with loops and arrays. For example instead of having seven if () statements for handling seven individual days of the week, you could reduce it to one...
0
1557
posted 14 years ago by dialeleven
This class is used to store global information for general access throughout the application.
0
1781
posted 14 years ago by ryantxr
Function to prevent sql injection in Like queries, where the characters '_' and '%' can be dangerous.
0
3330
posted 14 years ago by TimoZachi
This is a callback example that can be used to conditionally display blocks on specific pages. In this example, I load all nodes with a specific field and return false if the value of that field is equal to the user id of the logged in user. The sni...
0
1828
posted 14 years ago by chasecrawford
Sometimes it’s helpful to ONLY get numeric characters.
Phone numbers, age — whatever your little PHP heart desires.
0
3230
posted 14 years ago by satie83
replace /app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php
0
1873
posted 14 years ago by bogdandev
Adds an excerpt field to pages when editing. Goes in functions.php
1
1690
posted 14 years ago by klagraff
Once in a while we need to check whether a string contains substring, some other string or characters or a value. Checking for existence of a string (or substring) inside another string is easier than it might seem. The following article describes ho...
0
1973
posted 14 years ago by satie83
This function removes a directory and its contents.
Use with careful, no undo!
1
2183
posted 14 years ago by fackz
This function allow you ti have multiple parameters in your query string.
Ex : id=12&name=Doe&id=42&nickname=Monster
0
2870
posted 14 years ago by MonsterDev
Takes your table name and key=>value array of values and returns the text for inserting into a MySQL database. Automatically surrounds strings with single quotes.
1
2169
posted 14 years ago by lemcoe9
A simple function for converting a php timestamp (integer) to a user frindly format. Examples: 10 Seconds ago, 4 Days ago. The function converts timestamp to U.F. format only if the timestamp is earlyer than one week. Otherwise it uses $dateFormat ar...
0
2478
posted 14 years ago by TimoZachi
Nice implementation of Blowfish for storing user passwords to prevent decryption when for example the user database is compromised. Origin: Burak Guzel@Nettuts
2
3391
posted 14 years ago by ptodorov
Adds a method to the jQuery Validation plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) to return false if the field equals a specified string
0
3009
posted 14 years ago by StevenW721
Auto language selection based on site languages and user preferences.
0
1629
posted 14 years ago by Narayon
Insert this in functions.php to remove WordPress version from being output in the header source code
0
2791
posted 14 years ago by klagraff
A regular expression for removing <br> and <br> (case insensitive) between HTML elements if there is no content between the HTML elements. It was written for fixing extra line spaces created in a WordPress visual editor after the content of the visu...
0
2808
posted 14 years ago by pumpkinthehead
Useful for adding Custom Post types to navigation this will list all custom post type posts
1
2965
posted 14 years ago by i-am-andy
Manually print out a category-navigation in a magento frontend template. within "stristr" you can enter an array of category-ids that should be hidden from display.
0
2958
posted 14 years ago by luxmedia