Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
// example <br>
$from = '2011-1-6'; <br>
$to = '2011-1-8'; <br>
dateDiff($from,$to); // returns 2
        
        
        
            1 
        
        
            1436 
        
                    posted 14 years ago by klovera
            
            PHP
        
            How to obtain current page permalink url from a function on call on a page template and not from inside the Loop?  
        
                    I got the answer to this question on WordPress Stack Exchange website:
http://wordpress.stackexchange.com/questions/6931/is-there-a-wordpress-function-that-i-can-use-to-retrieve-the-current-page-that-is
        
        
        
            0 
        
        
            2642 
        
                    posted 14 years ago by racl101
            Use this to get the name of the custom taxonomy. Note that this only returns the name of the first selected item, but since this returns an array, use a foreach loop to find all names.
        
        
        
            0 
        
        
            2582 
        
                    posted 14 years ago by ToddSmithSalter
            To access a protected or private property, you need to create getter and setter
methods inside the class file.
        
        
        
            0 
        
        
            1040 
        
                    posted 14 years ago by shinokada
            Plugin gets child pages of parent in Wordpress. You'll need to pass the parent ID but this isn't difficult to figure out programmatically if needed, either.
        
        
        
            0 
        
        
            1465 
        
                    posted 14 years ago by ashworthconsulting
            Check if a string it's json encoded using regular expressions
Thanks to Jens Anders Bakke for his mootools code published in webfreak.no
http://webfreak.no/wp/2007/09/07/jsontest-for-mootools/
        
        
        
            0 
        
        
            1498 
        
                    posted 14 years ago by jatubio
            This code goes directly into your template.php file after you remove the open and close PHP tags at the beginning and end.
Then place the call below in your block.tpl.php. Don't forget to flush cache.
        
        
        
            0 
        
        
            1445 
        
                    posted 14 years ago by Onfire60
            Copy the first code snippet to your theme's template.php.
Then call the following section in you block template file.
        
        
        
            0 
        
        
            1215 
        
                    posted 14 years ago by Onfire60
            my wordpress loop with paging support and category,tag filteration
        
        
        
            3 
        
        
            1360 
        
                    posted 14 years ago by root_hacker
            And a now, word on the log.php maintenance script that comes with Magento 1.4 which has one major shortcoming.
It doesn’t maintain your dataflow_batch_* tables, said tables have been seen hiding in the wild at over a Gigabyte in size.
php -f...
        
        
        
            0 
        
        
            1112 
        
                    posted 14 years ago by TheJasonParker
            
