Category Archives: PHP

Everything PHP

WP-Config Disable Cron

define(‘DISABLE_WP_CRON’, true); //Disable page load cron

WordPress › Support » How to disable wp_cron via page loads and run it manually instead?.

WordPress Starter Plugin

Everything you need to write your own plugin. This is the starter solution. It shows how to plugin with your own class to wordpress, already set up custom functions. This is version 1 of this empty plugin. The admin menu (with a submenu), a settings page, another settings page. You can do just about anything your heart desires with wordpress, and plugging into it is pretty easy. Check this out:

Zen Cart Override Structure

Zencart has a great override system. I’m currently setting up a Zen Cart website and loving this override system. The only improvement I see that is REALLY NEEDED is an ADMIN OVERRIDE. That would be terrific. Until then here’s a schematic of the current Zen Cart override system.
Zen Cart Override Diagram

Related Posts

WordPress custom Functions.php I need. Thanks

Completely remove the version number from pages and feeds

A commonly cited security measure for WordPress-powered sites involves removing the automatically generated version number from appearing in the section of your pages’ source code. This type of security technique is referred to as “security through obscurity,” and aims at hiding potentially sensitive information from a would-be attacker. Here’s a function that does the job:

// remove version info from head and feeds
function complete_version_removal() {
return ”;
add_filter(‘the_generator’, ‘complete_version_removal’);
This will remove your site’s version and generator information from all of your pages and feeds, making it a little bit harder for the bad guys and a little bit safer for you and your visitors.

Delay feed update after posting

As a chronic perfectionist, I hate it when I post something only to discover an error a few minutes later. By the time I notice, fix and update the post, it’s already been beamed out all over the freakin’ place. To prevent this, I like to take the advice of WPEngineer and give myself a little buffer period or “safety net” after publishing my posts.

// delay feed update
function publish_later_on_feed($where) {
global $wpdb;

if (is_feed()) {
// timestamp in WP-format
$now = gmdate(‘Y-m-d H:i:s’);

// value for wait; + device
$wait = ‘5’; // integer


// add SQL-sytax to default $where
$where .= ” AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait “;
return $where;
add_filter(‘posts_where’, ‘publish_later_on_feed’);
This code quietly and automatically gives me an extra five minutes before my post is added to my feeds. If you need more or less than five minutes, just edit the “$wait” variable with the integer of your choice.

Add an Admin link to the WordPress “All-Settings” page

As we’ve explained before, WordPress makes it easy to view and edit your blog settings from the Admin area. Thanks to a file named “options.php”, WordPress will display all of your database settings and enable you to edit a majority of them. To view this page, you need to log in as Admin and enter this URL in your browser’s address bar:


Having access to your “All-Settings” page can be extremely helpful, so it’s nice to display a direct link for easy access. The following slice of code in your functions.php file is all that’s needed:

// admin link for all settings
function all_settings_link() {
add_options_page(__(‘All Settings’), __(‘All Settings’), ‘administrator’, ‘options.php’);
add_action(‘admin_menu’, ‘all_settings_link’);
Once in place, you will see a link to your “All Settings” page in the WordPress Admin. You can change the name of the link to whatever you prefer by editing the two instances of “All Settings”.

Thanks for the great code

Related Posts

ZenCart update from 1.3.8 to 1.3.9a FAILURE

Anybody else update from 1.3.8 to 1.3.9 and you cannot log into the admin anymore. Just an infinite loop of typing your password over and over again to end up back at the login screen with the username and password boxes cleared. When you type the password incorrect, it lets you know, but when it’s correct you’re stuck in an infinite loop of trying to log in over and over again.

Here’s what we do to fix this problem.

Stop using chrome because it’s horrible caching system messes me up developing 100% of the time! THANKS GOOGLE!

Related Posts

Zen-Cart html_output.php overrides

Zen cart’s forums and wiki are great, just somewhat of a pain in the ass, so here’s what i found that is useful, and i may use in the future too.

Posts: 2,925
Re: Overriding functions/html_output.php
There is no in-built override system for files in the includes/functions folder, but I recentyly figured out a method to do it by utilizing the override capabilities within the autoload/init_includes system.

First, make a copy of includes/init_includes/init_general_functions.php and save it in the includes/init_includes/overrides/ folder. Then edit that file to modify the loading of the html_output.php file so that it calls the file from an overrides folder like:
require(DIR_WS_FUNCTIONS . ‘overrides/html_output.php’);
Then you can create your new folder includes/functions/overrides/, and put an edited copy of html_output in there. This way you can edit or add functions within html_output.php and not have to worry about duplicate functions warnings, or about your changes getting overwritten during an upgrade.

You can use a similar method for overriding anything in the functions or classes folders, which don’t have an inherent override capability.
An assumption is what you arrive at when you get tired of thinking…

Related Posts

Moving a Zen Cart Installation

Here’s how I moved my Zen Cart installation to a sub directory.

1.) Create a sub directory on your site via: FTP or however you know to.

2.) Move all files of your Zen-Cart installation into your sub directory.

3.) Edit 2 configuration files of your zen-cart.

  • /includes/configure.php
  • /admin/includes/configure.php

In /includes/configure.php you want to edit:


In /admin/includes/configure.php you want to edit:


In both of these files you simply want to add your <subdirectory> followed by a forward slash /

NOTE: All directories should not have a leading slash / and SHOULD ALL have a trailing /

define(‘HTTP_SERVER’, ‘’);

define(‘HTTP_SERVER’, ‘’);

define(‘DIR_WS_ADMIN’, ‘shopping-cart/admin/’);

4.) Now you need to access your database via: phpMyAdmin or NaviCat

In your Zen Cart database you want to edit the configuration table in the following fields:

  • Log Destination – STORE_PAGE_PARSE_TIME_LOG
  • Session Directory – SESSION_WRITE_DIRECTORY

Use the following utility if you don’t know how to do step4:

This worked great for me.
Please comment here if you try this or have any questions.
Thank you.

Related Posts