Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged post



I looked everywhere trying to find some code that could show me how to display the post thumbnail if there is an image, but to display absolutely nothing if there isn't an image to display (most just either added an image or there was a broken image...
1 1783 posted 13 years ago by bdnnikki
A quick snippet of the PHP/Wordpress code behind my archive page, mainly for @andypoppins :D
0 554 posted 13 years ago by psdesignuk
0 563 posted 14 years ago by gd6d
To use it, simply create a new folder called “art-direction” in your theme. Then to style any particular Post or Page, just drop a file in that folder named style-XXXX.css where XXXX is the ID of the Post or Page. When that Post or Page loads, Wo...
0 649 posted 14 years ago by gd6d
Is also generates the .wp-post-image class for us to style
0 662 posted 14 years ago by crs
0 526 posted 14 years ago by gabbo
This code will loop through any posted variables and print the name of the field as well as the value of the field.
0 592 posted 14 years ago by BFTrick
I use this to activate basic forms for clients. Just make sure your form input names are named appropriately. Any inputs such as phone or fax that are separated into different inputs should have the same name.
1 760 posted 14 years ago by dmautz1
0 424 posted 14 years ago by iloveitaly
This is just a simple function to get the variable without having to worry if its POST or GET, and even allows for a default value to be passed in case the variable was not found.
0 593 posted 14 years ago by mondomondomxcom
There's no has\_children() function in WP 2.8.4, but get\_children() returns false if the post/page has no children, so it can serve the same purpose in a page template. Outside a page template you'd have to add a global declaration for the $post...
2 647 posted 14 years ago by cyberhobo
Here is a small function that I use to update records in a database. It coincides with the insertFromPost function that I have posted earlier. The element names in the form need to have the same name as in the DB and the field names should all...
1 676 posted 14 years ago by brownrl
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 849 posted 14 years ago by zartgesotten
1 746 posted 14 years ago by gfazioli
1 711 posted 14 years ago by gfazioli
fond this, and want to try it.
0 644 posted 15 years ago by stavelin
[quote]$_SERVER['HTTP_REFERRER']'s problem is that can be spoofed, but it's better than nothing if you really want that.[/quote]
1 841 posted 15 years ago by luizlopes
1 668 posted 15 years ago by Wiederkehr
This set of functions makes it quicker for me to code, might be useful to someone else =]
1 623 posted 15 years ago by alli14404
1 737 posted 15 years ago by stavelin
I'm working on a web app that requires me to track nearly 300 form fields. To make this easier, and to allow me to handle special cases, I needed to assign them to an internal array. The switch/case statement makes this a breeze.
1 618 posted 15 years ago by mdrisser
This can be used as a general function to get the value stored in any of the possible input sources. use
0 673 posted 15 years ago by luizlopes
This was taken out of a presentation by eZ systems on PHP Best Practices
0 602 posted 15 years ago by luizlopes
2 705 posted 16 years ago by evanwalsh