Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Thursday, October 3, 2013

This account has reached it's limit of concurrent processes - fixing a Wordpress issue

"This Account Has Reached it's limit of concurrent processes".

We got stuck with this problem on our hosting account that hosts about a dozen Wordpress sites.
After checking our server logs, wp-cron.php appeared to be the culprit.

Wp-cron.php helps by doing some automated things like posting scheduled content, checking comments for spam, and emailing comment notifications.  The problem is that wp-cron.php loads on every single page view, so this could be running hundreds, thousands, or millions of time each day, depending on your website traffic.

To stop wp-cron.php from running on every page visit, add this near the top of wp-config.php

define('DISABLE_WP_CRON', true);

To run wp-cro.php at your own chosen interval, create a cron job that runs every hour with the following line.  If your site only receives one or two comments per day, the cron job could be run every 12 or 24 hours.

wget -O /dev/null http://www.example.com/wp-cron.php?doing_wp_cron

via: wp-cron.php – How To Stop It From Running Frequently

Friday, June 21, 2013

Wordpress 2012 child theme modifications reference

The 2012 theme out-of-the-box is a great place to start for theme development because you have an editable navigation bar, good typography, and a clean layout to start with.

These are my go-to child theme modifications to 2012 when setting up a static website for a client.

Disable automatic word hyphenation
Requires: CSS / style.css
WordPress › Support » How does one stop auto text hyphenation completely

Move the header image above the navigation bar.
Requires: PHP / header.php
Cut the PHP block of code (pictured below) that outputs the header image and paste it above the NAV element that creates the main navigation.



Remove the space above the header image
Requires: CSS / style.css
Add these two CSS styles to your custom stylesheet to remove the spacing above the header image and make it flush with the top of the browser window.



Change the default "Leave a comment" link text
Requires: HTML/PHP | content.php
Go to line 28 on content.php.  Find the leave a reply text on this line and replace it with your wording of choice.
Hide the H1 page title only on pages
Requires: CSS /  style.css
Add the following CSS to hide the page title heading only on pages.  We use this because we want to still have automatic titles display on our single blog posts.


Sunday, May 26, 2013

Add sidebar creation option to the 2011 theme

How to Use Custom Sidebars on Posts and Pages | Wptuts+
This tutorial shows step by step how to add a theme option setting to add your own sidebars to a theme and then be able to apply them from the Page editor.  This is much more streamlined than having to a create a separate page template every time you want a page to have a different sidebar.




Monday, February 11, 2013

Resources to convert an HTML website to Wordpress

After converting several static HTML websites to Wordpress and XHTML, it's about time that I have some saved resources.  Code snippets are fantastic, working examples are even better.

WordPress Shortcodes: Why You Need Them and How to Create Them
This example shows the basic code needed to create a "wrapper" shortcode that will wrap HTML tags around your content.  After a shortcode has been created, it can be reused at will throughout a website.  Providing shortcodes to clients will make editing their site easier and allow them to integrate design elements without trudging through HTML.

Wordpress does not support shortcodes in widgets by default.  Add the one-line filter code at the bottom of the same tutorial to enable shortcodes in widgets.

CSS Styling Lists
Styled lists with CSS may help you clean up HTML that was left behind from a previous coder. The website I'm converting this month from static HTML to Wordpress had a bloated table layout to achieve links with "bulleted" images.  CSS list styles helped me to clear out all the unnecessary code and replace it with clean, beautiful markup.

Rounded corner layouts with DIVs.

CSS Image Rollover - Stack Overflow
This helped me convert javascript rollovers to pure CSS rollovers, which not only cleaned up the code, but will make it easier to edit in the future.

Box-shadow, one of CSS3′s best new features - CSS3 . Info
After combining the box shadow with a CSS border, I was able to replace a rounded corner box's nested HTML tables with some clean CSS.



Wednesday, October 31, 2012

Display an automatically updating copyright year with PHP

PHP snippet to output the current year:

<?php print date("Y")?>


PHP/HTML working Example
© <?php print date("Y")?>  My Business Name 

Wednesday, September 30, 2009

AJAX Contact Form

A simple AJAX Contact Form with JQuery and PHP Validation
- sent the email in about two seconds and used AJAX to give the delivery confirmation message on the same page
- Uses JQuery, but the email still seems to be sent quickly.

** Implemented on my site today.

Friday, July 31, 2009

Learning PHP

Ending lines
Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.

Comments
In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

Variables
When a variable is declared, it can be used over and over again in your script.

Rules for creating variables
A variable name must start with a letter or an underscore "_"

A variable name should not contain spaces. If a variable name is more than one word, it should be separated with an underscore ($my_string), or with capitalization ($myString)


Learning on W3Schools' PHP Tutorial