jamesoakley
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Categories and tags dissappearedI found the cause of the problem. The /tmp folder on the server is filled up. When that’s the case, the categories dissapear in wordpress. If you have root access to the server, then type:
df -hThis will give you the status of free space on your partitions. Make sure that /tmp isn’t 100% used by deleting the files inside it. try these commands to empty the /tmp:
cd /tmp find . -exec rm {} \;If you are hosting with a cpanel access, then on the left sdebar of your cpanel, there is a link called “Service Status”. Click on it and check the /tmp partition. If its’ full, contact your hosting technical support and tell them the problem and ask them to free the /tmp.
Good luck everyone 🙂
Forum: Fixing WordPress
In reply to: Missing Categories – Not Result of UpgradeI found the cause of the problem. The /tmp folder on the server is filled up. When that’s the case, the categories dissapear in wordpress. If you have root access to the server, then type:
df -hThis will give you the status of free space on your partitions. Make sure that /tmp isn’t 100% used by deleting the files inside it. try these commands to empty the /tmp:
cd /tmp find . -exec rm {} \;If you are hosting with a cpanel access, then on the left sdebar of your cpanel, there is a link called “Service Status”. Click on it and check the /tmp partition. If its’ full, contact your hosting technical support and tell them the problem and ask them to free the /tmp.
Good luck everyone 🙂
Forum: Plugins
In reply to: Display published posts after 30 minutes passedI was able to accomplish this through two steps:
1- Modify wordpress query.php to support adding a new parameter to the query string.
2- Use php to calculate the new delayed time.Step 1:
Open wp-includes/query.php and search for this line:
if ( $q['w'] ) $where .= " AND WEEK($wpdb->posts.post_date, 1)='" . $q['w'] . "'";and replace it with:
if ( $q['w'] ) $where .= " AND WEEK($wpdb->posts.post_date, 1)='" . $q['w'] . "'"; if ( $q['before'] ) $where .= " AND $wpdb->posts.post_date < '" . $q['before'] . "'";Step 2:
Here is my php function strtotime (check http://php.net/strtotime) to calculate the 2 hours delay time:
$unix_delayed_time = date(strtotime("-120 minutes"));then I convert the unix timestamp generated by strtotime into a normal Mysql date format using:
$delayed_time = date("Y-n-j G:i:s", $unix_delayed_time);then I used it in a loop:
query_posts('cat=3&before=$delayed_time'); // the Loop while (have_posts()) : the_post(); // the content of the post the_content('Read the full post »'); endwhile;So the total code is:
<?php $unix_delayed_time = date(strtotime("-120 minutes")); $delayed_time = date("Y-n-j G:i:s", $unix_delayed_time); query_posts('cat=3&before=$delayed_time'); // the Loop while (have_posts()) : the_post(); // the content of the post the_content('Read the full post »'); endwhile; ?>