WordPress editor removes div tags

How to fix:

Option 1: Disable WYSIWYG editor for user

In WordPress admin panel, go to “Users” tab and uncheck “Use the visual editor when writing” box.

Option 2: go inside the code and fix it

Find file wp-includes/js/tinymce/tiny_mce_config.php and change this line:

$valid_elements = 'p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';

to this:

$valid_elements = '-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';

EDIT: Apparently it doesn’t work for version 2.3.x, so here’s the fix for that:

change

‘p/-div[*]

to

‘p[*],-div[*]

Margins between images in Hotmail emails

Well… i have to confess sometimes i do email coding at my new job. Not so much coding as debugging it. Yes, we use HTML tables, circa 1999. You just have to, no other choice with flimsy CSS support. And the most annoying email clients are Gmail (sometimes), Outlook 07 and Hotmail. Hotmail being the WORST ever. People, if you still use Hotmail i urge you to switch to either Gmail or Yahoo. Stop being so lame!

If you code email with images, you will see that Hotmail inserts white spacing in between table rows. I found this solution which worked like a charm for me:

for each image put style=”display:block;” Yes, as simple as that. Gets rid of spacing.

Connors Newsletter

While working at my previous company, I was asked to design and develop a newsletter section of a company’s website. It was a fun project since there was no restrictions on what you could do.

The first version of the newsletter turned out a bit “corporate-y”, then the editors asked for something more fun and gave me this “laundry” theme (newsletter was called “Spin Cycle”). Here’s the final version:

Connors Newsletter

Previous version, which only was used during the first month.

Connors Newsletter

MySQL dates

PhpBB stores dates in INT fields in Unix time format, meaning the integer value equals to the number of seconds since 1/1/1970.

To view the date in standard format, use FROM_UNIXTIME(field) function.

select user_id, username, FROM_UNIXTIME(user_regdate) as d from phpbb_users

To select a time interval, we need to use FROM_UNIXTIME( ) function with a DATE_ADD() or DATE_SUB()

Example: select fields created less than 23 hours ago:

select user_id from phpbb_users where
FROM_UNIXTIME(user_regdate) > DATE_SUB(NOW(), interval 23 hour)

mySQL date functions reference: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

CSS borders in Firefox and IE

FF will display borders OUTSIDE of a div element, adding the border width to the element widget. IE will squeeze borders INSIDE and the total width stays the same.

Workaround for this which makes FF behave like IE:

* {
-moz-box-sizing: border-box;
}

(* applies it to all elements, if you don’t need that, add it only to a desired element)

Dates in MySQL

PhpBB stores dates in INT fields in Unix time format, meaning the integer value equals to the number of seconds since 1/1/1970.

To view the date in standard format, use FROM_UNIXTIME(field) function:

select user_id, username, FROM_UNIXTIME(user_regdate) as d from phpbb_users

To select a time interval, we need to use FROM_UNIXTIME( ) function with a DATE_ADD() or DATE_SUB() .

Example: select fields created less than 23 hours ago:

select user_id from phpbb_users where
FROM_UNIXTIME(user_regdate) > DATE_SUB(NOW(), interval 23 hour)

MySQL date functions reference.