php class troubles
Go to solution
Solved by Cheesebaron,
Can't remember why this does not work in PHP, but I know how to work your way around it.
Classes have something called a constructor, which is called when you instantiate a new instance of that Class. In there you can call that function get_option and get the date format.
So code like this would work:
class JSON_API_Query { protected $defaults = array( 'date_format' => 'F j, Y', 'read_more' => 'Read more' ); function __construct() { $format = get_option('date_format'); $this->defaults['date_format'] = $format; }}
You can test it here: http://goo.gl/CNW9v8

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now