Mass Delete WordPress Comments

Every once in awhile you may find yourself needing to mass delete WordPress comments in bulk for either SPAM comments, pending comments, approved comments or already trashed comments.

With access to your database and the ability to run a SQL command you can do any of the above with the proper line of SQL. I keep the below in a quick reference sheet but figure that other’s may find these useful, please use as needed but with caution. The below will remove comments from the default database prefix wp_.

*Always have a backup of your database before making large edits.

Mass Delete WordPress SPAM Comments

DELETE FROM wp_comments WHERE comment_approved = 'spam'

Mass Delete WordPress Pending Comments

DELETE FROM wp_comments WHERE comment_approved = '0'

Mass Delete WordPress Approved Comments

DELETE FROM wp_comments WHERE comment_approved = '1'

Mass Delete WordPress Trashed Comments

DELETE FROM wp_comments WHERE comment_approved = 'trash'

25. March 2014 by Gabe Diaz
Categories: Blog | Leave a comment

Working Girls Workshops

wg-01-thumb

wg-01-thumb

wg-01-thumb

wg-01-thumb

Name/Status:
workinggirlsworkshops.com/Online

Software:
Adobe Photoshop, PHP, HTML & CSS. Powered by WordPress.

Description/Role:
Custom WordPress theme development. Design provided by Serina Morris.

Technical Challenge:
None.

08. March 2014 by Gabe Diaz
Categories: Work | Leave a comment

HostGator.com 50% off Flash Sale!

HostGator.com 50% off Flash Sale, today only from 3PM EST to 7PM EST!

This is one of those coupon saving that you wish were always available. According to an email I just received this coupon is valid for all web hosting packages.

I think HostGator plays really well with WordPress and I’ve recommended them on several occasions to clients and friends who were in need of a host. I personally use HostGator for several domains and have been happy with their service for the several years that I have been a customer.

Aside from their HostGator shared hosting and VPS hosting plans, what I really enjoy is that their Customer Service via online chat, email and phone have been great to deal with. I’ve had mixed experiences in the past with other hosts in which it would take days to get a ticket resolved or having spent hours on the phone just waiting to speak with a Tier 1 technical representative.

Now, I would never tell anyone to drop their host, unless they are overpaying or are unhappy with their service. If you need a host, now would be a great time to save 50% off all hosting plans with the “HG50″ coupon code.

Visit HostGator and use the coupon code “HG50″.

Did you miss the HostGator 50% Coupon? You can still save 25% OFF on all web hosting packages by visiting HostGator and using the coupon code “SUMMER13DISCOUNT”.

24. July 2013 by Gabe Diaz
Categories: Blog | Tags: , | Leave a comment

The Fresh Diet

Blog - The Fresh Diet

Blog - The Fresh Diet

Blog - The Fresh Diet

05. December 2012 by Gabe Diaz
Categories: Work | Comments Off on The Fresh Diet

Penthouse Pets DLC – THQ

Penthouse Pets DLC - THQ

Penthouse Pets DLC - THQ

Penthouse Pets DLC - THQ

Penthouse Pets DLC - THQ

05. December 2012 by Gabe Diaz
Categories: Work | Comments Off on Penthouse Pets DLC – THQ

Staton Capital

Staton Capital

Staton Capital

Staton Capital

Staton Capital

05. December 2012 by Gabe Diaz
Categories: Work | Comments Off on Staton Capital

SPIN Boca

SPIN Boca

SPIN Boca

SPIN Boca

SPIN Boca

SPIN Boca

05. December 2012 by Gabe Diaz
Categories: Work | Comments Off on SPIN Boca

Armour Residential REIT

Armour Residential REIT

Armour Residential REIT

Position:
Design & Development

05. December 2012 by Gabe Diaz
Categories: Work | Comments Off on Armour Residential REIT

1&1 Hosting Transition to PHP5

Somewhere out there I am still on a 1&1 mailing list…luckily this email deals with PHP5 and our favorite platform, WordPress. This PHP5 update from 1&1 is also informative for users of Drupal, Joomla, osCommerce, phpBB, Typo3 and more. If you did not receive 1&1’s email you can read it in it’s entirety below.

Subject: Important information: transition to PHP5

Dear Mr. Diaz,

Our goal is to keep pace with all new technical and security-related requirements.
For this reason, we inform you today about the transition to a new PHP version.

From April 1, 2013, the PHP versions 4 and 5.2 will not be supported anymore.
As of now, we will use the version PHP 5.4 instead.

In order to benefit from the new PHP version as quickly as possible, you should already switch to the new version now. To do this, log in to your 1&1 Control Panel (https://www.1and1.com/login) and choose the current PHP version PHP 5.4 under
“Global PHP Version”. Then, check if your website and scripts run properly. For more information on PHP, please refer to our FAQ section at: http://faq.1and1.com/scripting_languages_supported/php/

Important:
From April 1, 2013, the versions PHP 4 and PHP 5.2 will not be supported anymore. Therefore, do not wait too long before you switch your version. Thus, you ensure that your website is displayed correctly and your scripts operate smoothly.

Please note that after the transition, the option “Register Globals” will not be supported anymore. Furthermore, we recommend updating the following applications in particular:
– Contao
– Drupal
– eGroupWare
– Joomla
– MediaWiki
– myorgbook
– osCommerce
– phpBB
– Serendipity
– Shopware
– Typo3
– WebCalendar
– WordPress
– XOOPS
– xt:Commerce

Do you have any further questions?
Please feel free to call us. Our team will be pleased to support you – 7 days a week, 24 hours a day: 1 – 866 – 991 – 2631
Or send an e-mail to: [email protected]

We wish you a lot of success with your new PHP version!

Yours sincerely,
Web Hosting Team
1&1 Internet Inc.

30. November 2012 by Gabe Diaz
Categories: Blog | Leave a comment

Background Ad Takeover for WordPress

I’m sure we’ve all seen background ad takeovers as they take up the wallpaper or background screen of the site you are visiting. These types of ad backgrounds are popular with entertainment sites because they give advertisers large visual space to promote an event, movie, game release…just about anything. Takeover ads work great with fixed width sites and can create a nice call to action, as seen in the samples below:



Now that we have an idea of what type of ads we are talking about, let’s move ahead and work toward displaying an ad solely on the homepage of your site.

Targeting Your WordPress Home Page
If we only want our background ad to appear on the homepage of our site we will use a simple statement to check if the home page is the current page. We will also want to target your homepage with a custom background so we will be making sure that your body class on the main page is being displayed. The content we will be editing will normally be found in your header.php but look in your template for where your tag begins.

With a small change WordPress can let you apply a class of options to your body tag based on what page you are on. For example a single post page on my site such as this page has the body class of:

class="single single-post postid-910 single-format-standard logged-in"

To get the above, let’s make sure our tag looks like the one below.

<body <?php body_class(); ?>>

Directly after your updated body tag we will be using an if statement to see wether or not your WordPress site is displaying the front page.

<?php 
if (is_front_page()) echo '<a style="height:1200px;" id="ad_bg" href="http://gabediaz.com" target="_blank" rel="noopener noreferrer">&nbsp;</a><div id="wrapOuter">
'; else echo '<div id="wrapOuter">';
?>

What the above means:
Here WordPress checks to see if your site is displaying your front page. If so, your site body will be starting with a link that is 1200px in height and includes the empty anchor text which points to your banner’s target landing page before starting your body content. Else, if your visitor is on any other page on your site, WordPress will begin your site body with a regular div expression, in this case it’s [div id=”wrapOuter”]. In both cases your site body will begin with some type of container, the if statement just figures out if it should add in an empty link prior to your content.

The close of your head tag, the start of your body tag and the beginning of your content wrapper should look like the following (please note: your div id will be different):

</head>
 
<body <?php body_class(); ?>>
 
<?php 
if (is_front_page()) echo '<a style="height:1200px;" id="ad_bg" href="http://gabediaz.com" target="_blank" rel="noopener noreferrer">&nbsp;</a><div id="wrapOuter">
'; else echo '<div id="wrapOuter">';
?>

*If you want the same ad to appear throughout your site on every page, use the following format. You do not need to use an if statement, just insert your link right after your body tag. Apply your background to your main body with CSS.

</head>
 
<body <?php body_class(); ?>>
 
<a style="height:1200px;" id="ad_bg" href="http://google.com" target="_blank" rel="noopener noreferrer">&nbsp;</a>

Adding Some CSS Properties to Your URL
We want to make sure the clickable area of our background spans the length and width of our window as well as changes the mouse pointer on rollover to the pointer finger.

#ad_bg{
top: 0;
left:0;
position: absolute;
display: inline;
width: 100%;
cursor: pointer;}

Please Note
Above we are giving the URL an absolute positon

position: absolute;

This will span the URL across your viewport and unless your middle content area or wrapper class has a relative position this URL will basically cover all of your pages links. So check for or add the following to your middle content ID or Class.

position: relative;

Setting Your New Background with CSS
Lastly we set a new background image to be seen only on the main page with a little CSS. This is where our body class tags work to our advantage. Since we are on the front page our body will have a class of “home”

Add to your style.css file:

.home{
background:url('ReallyCoolBackgroundImageTakeOver.jpg');
background-position:top center;
background-repeat:no-repeat;
background-attachment:fixed;}

For the .home class we are setting a background image, aligning it to the top and center of our site, not repeating the image vertically or horizontally and making the background image fixed in place. The property “background-attachment:fixed;” means that when a user scrolls down a page, the background will stay put while only the center site content will scroll down. This is done to keep your background ad in position and visible no matter how far a user scrolls down your page.

See It In Action
Before I link to a test page with these theme, here are some things to consider:

1) This theme is responsive, so it breaks when adding a background takeover. Why? Well because the only fixed column in the theme is the left most sidebar column. The center column and right column are floated and due to this the background becomes clickable for 2/3 of the width of the page.
2) To correct this I added an additional container around my content div and set the margin to auto to center it.
3) I was able to use the same “if statement” from above to make the new container div appear only on this test page.
4) The demo page is an actual Page from this very WordPress installation, it’s not on a Demo install. It’s actually a good example of being target specific pages by their body class and with an array or if statements. You could essentially have a different background for every section, page or post in your WordPress installation.
5) The demo page: Sample Background Takeover

Extending Functionality – Added December 4, 2012

Joe in the comments asks:

If I have categories or single posts / pages where I want a specific background image tied to, what would the code look like?

Great question, the answer to this question alone, along with all the possibilities is a complete post in itself but I’ll quickly show you how easy it is to add a background ad to a targeted Page, very similar to targeting the Home Page. As mentioned above, the sample page: Sample Background Takeover is a Single Page from this site with background in action, here’s the code that specifically targets the Page Sample Background Takeover.

In my header.php

<?php 
if (is_page(933)) echo '<a style="height:1200px;" id="ad_bg" href="http://google.com" target="_blank" rel="noopener noreferrer">&nbsp;</a><div id="wrapper"><div id="wrap" class="clearfix">
'; else echo '<div id="wrap" class="clearfix">';
?>

In my footer.php:

<?php 
if (is_page(933)) echo '</div></div><!--end Wrap-->'; else echo '</div><!--end Wrap-->';
?>

Added to css file:

.page-id-933{
background:url('Safe_Skin_FINAL_v2.jpeg');
background-position:top center;
background-repeat:no-repeat;
background-attachment:fixed;}

Using the same format above, with if statements, you could target the Home Page and a Single Page (by ID, slug, title etc.). View the Conditional Tags page in the WordPress Codex for more conditional samples.

30. April 2012 by Gabe Diaz
Categories: Blog | Tags: | 20 comments

← Older posts