Php


📖 Posts | 📎 Blogging, Development | 🔖 html, php, wordpress

WordPress tweak to manage posts admin, filter and show custom field

This tweak will change the “All Posts” page in the administration section of a WordPress site.

It adds the ability to filter the post list based on a custom field that has been used in any of the posts at any time.


📖 Posts | 📎 Development | 🔖 php

Defaulting optional parameters

If you have a function that takes an optional parameter – e.g. function blah($xx,$yy='Default',$zz){ .... You can use the function and ensure that the optional parm always takes the correct default (even if the definition changes) by passing a NULL to it. e.g. ... $mydate=blah($something,NULL,$more); .


📖 Posts | 📎 Development | 🔖 php

Handle web parameters gracefully in PHP

# Handle web parms (Call as: myParms('report');) # Ensures that the given parm is always set function myParms($var) { global $$var; if(isset($_REQUEST[$var])){ $$var=$_REQUEST[$var]; } else { $$var=''; } }