How do I revert wordpress to the original theme?

January 22nd, 2013 No comments

My wife was playing with her site http://nrotxn.com when she installed a theme that required wordpress 3.5 which she hadn’t installed yet. It caused her site to go dead. Fixing it was easy, just run this query to change two rows in the options table back to a theme you do have installed:

UPDATE  `wp_options` SET  `option_value` =  'twentyten' WHERE  `wp_options`.`option_name` = 'template';
UPDATE  `wp_options` SET  `option_value` =  'twentyten' WHERE  `wp_options`.`option_name` = 'stylesheet';
Categories: wordpress Tags:

MySQL Temporary Tables and CakePHP 1.3

July 24th, 2012 2 comments

So, if you create a MySQL temporary table in CakePHP, when you try to create a model for that table, it dies, because mysql “Show Tables” doesn’t show temporary tables.  To get around this, implement the setSource function in your model..  i.e.

class WholesalerLeadsDataTemp extends AppModel{

	var $name = 'WholesalerLeadsDataTemp';
    function setSource($tableName) {
        $this->setDataSource($this->useDbConfig);
        $db =& ConnectionManager::getDataSource($this->useDbConfig);
        $db->cacheSources = ($this->cacheSources && $db->cacheSources);

        //MySQL Doesn't return temporary tables in the list of tables, so we have to disable this check...  (yay...)...
//        if ($db->isInterfaceSupported('listSources')) {
//            $sources = $db->listSources();
//            if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
//                return $this->cakeError('missingTable', array(array(
//                    'className' => $this->alias,
//                    'table' => $this->tablePrefix . $tableName,
//                    'code' => 500
//                )));
//            }
//            $this->_schema = null;
//        }
        $this->table = $this->useTable = $tableName;
        $this->tableToModel[$this->table] = $this->alias;
        $this->schema();
    }
}
Categories: Uncategorized Tags:

html5 css3 border-radius

June 14th, 2012 No comments

This awesome site: http://border-radius.com is a really really simple buy awesome border radius generator.  It’s very cool.

Categories: css, html5 Tags:

jQuery .is method.

March 26th, 2012 No comments

This is probably the best way I’ve seen to see if a checkbox is checked or not on a click event…

jQuery(this).is(‘:checked’);

Some more awesome jQuery checkbox reference material: http://gaskell.org/determining-if-a-checkbox-is-checked-with-jquery/

Categories: jquery Tags:

Escape CSS Selector

March 26th, 2012 No comments

Frequently, I am composing css selectors for jQuery dynamicly and need to escape special characters.  Especialy in CakePHP when you are trying to get all inputs with a name like “data[Contact][firstName]“.

Karl Varga has a solution - http://kjvarga.blogspot.com/2009/06/jquery-plugin-to-escape-css-selector.html

Thanks Karl!

Categories: css, javascript Tags:

PHP Development Tools that Make Money – Wordcamp Phoneix 2012

February 26th, 2012 3 comments
Categories: php Tags:

Enable MySQL Slow Query Logging Without Server Restart

February 7th, 2012 No comments

When mysql stops responding…  You can usually bet on finding slow queries to be the culprit.

You can easily enable slow query logging without restarting the server.

Just run:

set global log_slow_queries = ON

Categories: mysql Tags:

How to obtain a users time zone via Javascript

January 2nd, 2012 No comments

This approach isn’t perfect, but for US users, it should be correct 100% of the time.

This blog author describes how he has created a function that uses the Javascript Date objects getTimeZoneOffset method to test various dates and determine what timezone the users computer is likely set to.

Here is the post: http://blog.redfin.com/devblog/2007/08/getting_the_time_zone_from_a_web_browser.html

Categories: javascript Tags:

A Good custom permalink string for WordPress

October 5th, 2011 No comments

I really dislike the default wordpress permalink choices. My favorite, is to put this in the custom permalink string: “/%category%/%postname%/”

Joey

Categories: wordpress Tags:

Why you should Turn off Output buffering in php when developing code for others…

September 29th, 2011 2 comments

A few times now I have developed code for my clients, and when I send it to them, they get an error dealing with output already being sent when something attempts to send a header… You know the classic:

Warning: Cannot modify header information – headers already sent by (output started at /home/a/public_html/wp-admin/includes/plugin.php:1721) in /home/a/public_html/wp-includes/pluggable.php on line 934

This is caused by output having already been sent to the browser, and the headers have to go before the output. Php is smart enough to clear the output buffer if possible before sending headers… So if the output buffer hasn’t been sent to the browser yet because output buffering is enabled php will clear the buffer, and send the header. But if output buffering is disabled, you get an error… And something won’t work right…

So, open up your php.ini file and set output_buffering = Off.

Cheers!

Joey

Categories: php Tags: