The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
| /* Delete duplicate posts */ | |
| DELETE bad_rows.* | |
| from wp_posts as bad_rows | |
| inner join ( | |
| select post_title, MIN(id) as min_id | |
| from wp_posts | |
| group by post_title | |
| having count(*) > 1 | |
| ) as good_rows on good_rows.post_title = bad_rows.post_title | |
| and good_rows.min_id <> bad_rows.id |
| # Chmod all files and directories | |
| find . -type d -print0 | xargs -0 chmod 0755 | |
| find . -type f -print0 | xargs -0 chmod 0644 | |
| # run command as another user | |
| sudo -u USER -H COMMAND | |
| # find and remove files | |
| find . -type f -name "FILE-TO-FIND" -exec rm -f {} \; |
| /* ============================================================================= | |
| WordPress WYSIWYG Editor Styles | |
| ========================================================================== */ | |
| .entry-content img { | |
| margin: 0 0 1.5em 0; | |
| max-width: 100%; | |
| height: auto; | |
| } | |
| .alignleft, img.alignleft { |
| <?php | |
| /** | |
| * The base configurations of the WordPress. | |
| * | |
| * This file has the following configurations: MySQL settings, Table Prefix, | |
| * Secret Keys, WordPress Language, and ABSPATH. You can find more information | |
| * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing | |
| * wp-config.php} Codex page. You can get the MySQL settings from your web host. | |
| * | |
| * This file is used by the wp-config.php creation script during the |
| # Turn on rewrite | |
| <IfModule mod_rewrite.c> | |
| Options +FollowSymlinks | |
| RewriteEngine On | |
| # RewriteBase / | |
| </IfModule> | |
| # rewrite olddomain.com → newdomain.com | |
| <IfModule mod_rewrite.c> | |
| RewriteCond %{HTTPS} !=on |
| // External links new window | |
| $("a[href*='http://']:not([href*='"+location.hostname.replace | |
| ("www.","")+"'])").attr('target','_blank'); | |
| // rel=external new window | |
| $("a[rel='external']").attr('target','_blank'); |
| <span class="at">|</span> <span class="format">{</span> | |
| |<span class="selector">|</span> <span class="format">{</span> | |
| | <span class="property">|</span> <span class="value">|</span><span class="format">;</span> | |
| |<span class="format">}</span>| | |
| | | |
| <span class="format">}</span> | |
| ||<span class="comment">|</span> | |
| | |
| /** | |
| * Disable new user registration emails sent to the site admin | |
| */ | |
| function disable_registration_email_filter($result = '') { | |
| extract($result); | |
| $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); | |
| if (strstr(sprintf(__('[%s] New User Registration'), $blogname), $subject)) { | |
| $to = ''; | |
| $subject = ''; | |
| $message = ''; |
| UseCanonicalName Off | |
| DocumentRoot /path/to/www | |
| VirtualDocumentRoot /path/to/www/%1 | |
| ServerName %1.local | |
| CacheDisable /path/to/www/%1 | |
| <Directory /path/to/www/%1> | |
| Options Indexes FollowSymLinks Multiviews +Includes | |
| AllowOverride All | |
| </Directory> |