Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
**Important: this snipplet has moved to Github.**
- [Force the admin theme on additional non-admin paths in Drupal 6](https://gist.github.com/1973090)
3
761
posted 13 years ago by wildpeaks
Snippet for adding to your functions.php file to enqueue jQuery.
1
517
posted 13 years ago by oriontimbers
If you're importing nodes from a file and have pathauto setup, the existing paths for the nodes will be rewritten with pathauto. To avoid this, simply add the following to the node export array for each node:
0
572
posted 13 years ago by jonathanpglick
Sale Price/Variation custom
this code just work if all variation price is a same as product price
0
329
posted 13 years ago by haftim
Sale Price/Variation custom
this code just work if all variation price is a same as product price
0
308
posted 13 years ago by haftim
Counts the number of times that a file has been downloaded, using PHP and mySQL
0
536
posted 13 years ago by eme_dlr
I set up an $isHome boolean variable at the beginning of a template's index.php file so I can easily test the condition throughout the file. To me, the semantic variable name makes the logic more readable.
0
500
posted 13 years ago by beneberle
**Important: this snipplet has moved to Github.**
- [Programmatically log out the user in Drupal](https://gist.github.com/1973079)
0
583
posted 13 years ago by wildpeaks
Im pretty new to oop php i have tried to create a php search function but im sure this needs alot of improvement. So add on :D
0
435
posted 13 years ago by JonnySnip3r
You may want to create navigation where the children are displayed only when the parent page is the current page. Place the code in your functions.php file
0
462
posted 13 years ago by awesomewordpressthemes
Just include
**global $user;** and
**$user->uid != 1** into the function
0
667
posted 13 years ago by resting
How to enable Custom Navigation Menus in WordPress 3.0
Like the custom background, header image, and post thumbnails, the custom navigation menus also needs to be enabled through your theme’s functions.php file.
0
618
posted 13 years ago by johnnyrokkit
The total number of search results can be added in a hook_preprocess_search_results() function from the following variable:
0
652
posted 13 years ago by jonathanpglick
This will find the first image in post and return it as a thumbnail if it exists
0
901
posted 13 years ago by howardpanton
Simple function to store an array in a cookie. Uses JSON.
To pull data out of cookie use 'json_decode()'. It can then be looped etc.
1
1211
posted 13 years ago by liamchapman
This strips out any html tags (like paragraph tags) from the excerpt in WordPress.
0
533
posted 13 years ago by nonsalant
Quick and simple script to make clean urls. Works in combination with Apache mod_rewrites :-)
1
530
posted 13 years ago by liamchapman
For instance when you want to leverage the JElements in a admin view form...
0
687
posted 13 years ago by harikaram