kccricket
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Simple wp_rewrite rule not workingAfter much gnashing of teeth and popping of joints, I have discovered my issue.
WordPress was relying on a stale array of rewrites it had stored in the database (wp_options table). A
var_dump($wp_rewrite->wp_rewrite_rules())revealed that my custom rewrites at the end of the array weren’t changing as I tried different combinations of rules in the plugin.Manually dropping the
rewrite_rulesrow in the wp_options table forced WordPress to recreate the ruleset. If I make any other changes to the rules in the plugin, I have to drop that row or the changes don’t take effect.Is this a bug, or am I doing something wrong?
Forum: Fixing WordPress
In reply to: Simple wp_rewrite rule not workingJust for reference, this is not for use on kccricket.net. The site I’m doing this for is not currently publicly available.
doing /index.php?category_name=poetry gives me exactly what I expect. The category does exist and does contain at least one post. Thanks, I appreciate the help anyways.
Forum: Fixing WordPress
In reply to: Simple wp_rewrite rule not workingThe ? should specify that the slash is optional. Nevertheless, I have tried without the question mark.
Forum: Plugins
In reply to: New Plugin: Cricket MoodsI have confirmed that Cricket Moods 2.0 does not have a compatibility issue with WordPress 2.0, as far as the actual code goes. The only problem is that the default location for WP’s smilies moved from /wp-images/smilies to /wp-includes/images/smilies. Simply change the appropriate option in the Cricket Moods option panel. I will address this in version 3.0.
If you need further help, you can always reach me at kccricket-at-gmail-dot-com.
Forum: Plugins
In reply to: Bang on the Cricket MoodsI guess if no one feels like testing my plugin, I’ll go ahead and pack up a “release.”
Forum: Themes and Templates
In reply to: Search results not using archive.phpRoger that. Is it planned to work the “wrong” way eventually, or was the misprint just a misprint?
Forum: Plugins
In reply to: Adding field to post.phpWordPress has two plugin hooks that allow you to add extra markup (text, fields, etc.) to the end of the edit forms that post.php displays. They are “simple_edit_form” and “edit_form_advanced”. It would be best not to modify post.php directly, but rather write a plugin to do it.
As far as parsing the values of your custom fields go, you could try the approach I used in Cricket Moods. It does not require any changes to the database. It stores everything as standard post metadata.
Look in the source for my plugin and examine my cm_get_posted_moods() function:
/**
cm_get_posted_moodsParses $_POST elements and returns an array of
the values (mood ids) used by CM. Returns FALSE
if no applicable values were submitted.
*/
function cm_get_posted_moods() {
$moods = array();
foreach($_POST as $key => $val) {
// CM input element names are prefixed by 'cm_mood_'.
if( substr($key, 0, 8) == 'cm_mood_' )
$moods[] = stripslashes( trim($val) );
}if( !empty($moods) )
return $moods;
else
return false;
}I prepended the “name” attribute of each field I added to post.php with “cm_mood_”. You can use something different. This function returns an array of the custom values, but does not use the “name” attributes for keys.
The function above is used by a function that is called by the “save_post” and “edit_post” actions. This second function basically does this:
foreach($moods as $mood_id) {
$wpdb->query("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value) VALUES ('$post_ID','mood','". $wpdb->escape($mood_id) ."')");
}The second function is called “cm_update_moods” if you’re looking in the source.
Basically, writing a plugin would be much more effective in your situation. Feel free to use large portions of my plugin, if you need to; it has a very non-restrictive license.
Forum: Plugins
In reply to: 2 or more loops causing troubles with pluginsIt may result in the same (or a similar) issue, but Kafkaesqui just released a plugin that does exactly what it sounds like your “custom loop” is doing:
http://wordpress.org/support/topic/25987
You can try it, and if it works fine, problem solved!