Welcome To Snipplr


Everyone's Recent PHP Snippets



1 ... 113 114 115 116 117 ... 147
Here is the correct way to turn your mysql results into an array. Forget the other nonsense of useless code. Why type out this long code: "for($i = 0; $array[$i] = mysqli_fetch_assoc($result); $i++) ;" when you can accomplish the same thing with m...
1 1580 posted 16 years ago by the_dev
Like python's os.listdir
1 1625 posted 16 years ago by iloveitaly
0 813 posted 16 years ago by iloveitaly
This is a great way to save complex objects as cookie values. You can't just json_encode because commas are not legal in cookie values. Remember not to use this for anything too big because cookies have a 4KB limit.
1 1171 posted 16 years ago by segdeha
1 1214 posted 16 years ago by nico65
Adds two "sidebars" to the header. You can drag and drop widgets into them just like any other sidebar from your WP dashboard. You can change the Hook to move the "sidebars" somewhere else on the page. For example, change 'thesis_hook_header' to '...
4 3069 posted 16 years ago by fouroclockproject
0 1110 posted 16 years ago by benjaminpearson
2 1743 posted 16 years ago by Thresh
0 1215 posted 16 years ago by sinecera
Completely changed original function, which stopped working around WP2.8.
1 1265 posted 16 years ago by kristarella
There's another snippet on here that always comes up on google for finding the relative path to the root, but it doesn't work very well. This version will work from the root, from any subdirectory, and with malformed path names such as www.example.co...
3 2059 posted 16 years ago by blackhole12
This little bit of code is a calculator of the "golden mean" of a given length of time. For example: given a length of 1 minute and 0 seconds, the answer given will be 0:00:37. See U2's "With or Without You", the Greek Parthenon, the human body, etc....
1 2725 posted 16 years ago by rossuber
3 1756 posted 16 years ago by cshaiku
3 1539 posted 16 years ago by cshaiku
2 1677 posted 16 years ago by cshaiku
0 1096 posted 16 years ago by martin_rusev
0 970 posted 16 years ago by nico65
All you need to do when writing the post, is enter a custom field with the key "expiration" and set the value in the format: "2010/01/01 18:20:00" - this would expire the post at 6.20pm on the 1st January 2010.
1 1359 posted 16 years ago by gjindancer
I pieced together this code when I had to do this for a client: - show the first image attached to a post (based on sort order in gallery tab) in medium size - put all the other images attached to the post into an imageset so that when you click on...
1 1767 posted 16 years ago by zartgesotten
This will output the resulting meta value (notice the addition of "echo"):
1 1251 posted 16 years ago by rickfu
1 ... 113 114 115 116 117 ... 147