Andrew
Forum Replies Created
-
Forum: Plugins
In reply to: [Plugin: Custom Field Template] display several options side by side?FYI, in prox’s initial post, the CSS code has a typo — it’s missing a semicolon after 45% (and after 4% as well, but that might not matter).
Thanks for this — sorry I didn’t say so earlier. I’ve been battling with custom fields (and various plugins), and didn’t make it back here.
The fieldsets advice is particularly helpful for what I’m trying to do. Finally, an admin page the way I want it!
Yep! It’s simple, but you shouldn’t have to do it.
In the Admin CSS section, add this line:
#cft_selectbox {visibility:hidden;}
Ta-da!
Forum: Fixing WordPress
In reply to: XHTML parsing in email subjects?Ditto for me. Drives me nuts, and I want my blog to remain “Andrew Kantor’s Place” and not “The Place of Andrew Kantor.”
I’m wondering if it’s because I declare the namespace to be XHTML in the head:
<html xmlns="https://www.w3.org/1999/xhtml">
Forum: Fixing WordPress
In reply to: MySQL query to search posts and change categories?GOT IT!
Here’s how I was able to go through all my posts and look for specific text — “/images” — in them. When I found a post containing “/images”, I changed the category number to “8” (which corresponds to my category “Photos”).
<?php $username="MY_MYSQL_USERNAME"; $password="MY_MYSQL_PASSWORD"; $database="MY_DATABASE_NAME"; $my_text = "/images"; // What I'm searching for $my_category = '8'; // The category to change it to // Connect to MySQL and the database and verify: mysql_connect(localhost,$username,$password) or die(mysql_error()); echo "<p>Connected to MySQL."; mysql_select_db($database) or die(mysql_error()); echo "<br />Connected to " . $database . "</p>"; // Verify what we're looking for, for troubleshooting: echo "<p><b>Looking for " . $my_text . "</b></p>"; // Get the ID field (which is WordPress's post // number) from any posts that have your text: $query = "SELECT ID FROM wp_posts WHERE post_content LIKE '%$my_text%'"; // Take those results and go through them: $result = mysql_query($query) or die(mysql_error()); // While there are results... while($row = mysql_fetch_array($result)) { // Verify what we're doing -- changing post // number such-and-such... $thisPostHasIt = $row['ID']; echo "<p>Row " . $row['ID'] . " contains it, so...<br />"; // In the wp_term_relationships table, // update the category number ("term_taxonomy_id") // with the category number you specified -- but only // in one of the "result" rows. // We look for "object_id" to equal one of those // rows. (The object_id field refers to the WordPress // post number, just as the ID field did. Why two // different names? Who knows?) mysql_query("UPDATE wp_term_relationships SET term_taxonomy_id='$my_category' WHERE object_id = '$thisPostHasIt'"); // And tell us about it: echo "Changing post number " . $thisPostHasIt . " to category number ". $my_category . "</p>"; } echo "<p><b>All done!</b></p>"; ?>
Thanks for all your help! Next step: Adding a clean HTML form interface. Allowing multiple changes (if this OR that). Changing more than just category (add a tag, for example).
Forum: Fixing WordPress
In reply to: MySQL query to search posts and change categories?I’m so close to getting it to work, but I’m not quite there. The script runs, and appears to update, but it doesn’t actually change the values. I’m guessing it’s something small I didn’t code right.
Here’s what I have:
<?php $username="myname"; $password="mypass"; $database="mydatabase"; $my_text = "needle"; //what I'm searching for $my_category = '8'; //whatever category number it is mysql_connect(localhost,$username,$password) or die(mysql_error()); mysql_select_db($database) or die(mysql_error()); $result = mysql_query("SELECT ID FROM wp_posts WHERE post_content LIKE '%$my_text%' "); // select all posts that have your text while ($row = mysql_fetch_array($result)) { mysql_query("UPDATE wp_term_relationships SET term_taxonomy_id=$my_category"); // add category to that post } //while have posts ?>
Any ideas? Do I need a FOR loop? Thanks!
Forum: Fixing WordPress
In reply to: MySQL query to search posts and change categories?Wonderful! Between the two of you, I should have enough to go on — and if it’s not, it’s enough for me to figure it out with a MySQL/PHP reference. Thank you!
(Hmm… wonder if it’s worth making this into a plugin if it works. Could be useful if you could choose where to search, what to search for, and what to do with entries that match.)
Forum: Fixing WordPress
In reply to: MySQL query to search posts and change categories?I think this is what I need to do, but I don’t know SQL nearly well enough:
Search through the wp_posts table for any entry where post_content contains “search_string.”
For each entry where “search_string” occurs, get the entry’s ID, then find that ID in the wp_term_relationships table (where it’s called “object_id“). Then change that entry in wp_term_relationships so that its term_taxonomy_id is, for example, 4.
Does that make sense to anyone but me?
Forum: Plugins
In reply to: [Plugin: Register Plus] Display different text for field name?Never mind — figured it out.
The name you give the variable in the Register Plus interface is NOT necessarily the name used in the database. Spaces are converted to underscores, as is punctuation.
So while the reg page displays “What County Do You Live In?” the variable name behind the scenes is What_County_Do_You_Live_In.
Now I can do magic based on where these folks are.
Forum: Plugins
In reply to: [Plugin: Countdown Timer] Remove break and word “in” from display?Unfortunately it doesn’t help now — the countdown is over. But I’m sure I’ll use it again. If the problem comes back I’ll drop a note here. Thanks for your help!
Forum: Plugins
In reply to: [Plugin: Countdown Timer] Remove break and word “in” from display?Hmm… then I must be doing something wrong, because the line break won’t go away. Right now the Title Suffix is set to simply ” ” but it’s still breaking the line.
The example display shows it just the way I want it, but in reality there’s an extra br tag.
Forum: Themes and Templates
In reply to: Listing subcategories under categoriesI see — that’s exactly it. But I can’t figure out how you’re doing it. (Rather, why it isn’t working for me.)
* * *
Correction: I got it working. It seems that even though the ULs and LIs are within a DIV, they are still getting their formatting from the overall UL and LI styles. So I kept changing (in my case) “#left ul” and “#left li” to no avail. Once I fixed the general ul and li style, though, it worked.
It doesn’t make sense to me, but heck, it’s working. Thanks for taking the time to help!
Forum: Themes and Templates
In reply to: Listing subcategories under categoriesAll right — it’s almost right. What I can’t seem to do is set the style for the main category to be different than the style for the child categories.
I’m trying to make the main categories big and bold, with the subcats beneath them having bullet points. What I get is both having bullets and any changes I make to the CSS are reflected in both.
Is there a way I can get the cats and subcats to be handled differently?
Thanks!
Forum: Themes and Templates
In reply to: Listing subcategories under categoriesAhhhhh. I see what I was missing. The theme I used had the styles for UL and LI being almost identical, so I couldn’t see the fact that this was doing what I wanted.
Thanks for your help!
Forum: Plugins
In reply to: live-comment-preview doesn’t work(Sorry for the multiple posts, but it doesn’t seem to like the code markup!)
I love the idea of this plugin, but, well, nothing happens when I install and activate it. I should say that nothing happens in my customized theme; it works if I switch to the WordPress Classic theme.
Obviously I’m doing something wrong. Here’s the relevant section of my comments.php file:
<?php if (comments_open()) : ?>
<form action=”https://www.kantor.com/blog/wp-comments-post.php” method=”post” id =”commentform”>
<h3>Weigh in</h3><p><small>Yer name:</small>
<input type=”text” name=”author” size=”21″ value=”<?php echo $comment_author; ?>” tabindex=”1″ /></p><p><small>Yer e-mail (so I can respond privately — never ever shared):</small>
<input type=”text” name=”email” id=”email” value=”<?php echo $comment_author_email; ?>” size=”40″ tabindex=”2″ /></p><p><small>Yer Web site (if you like):</small>
<input type=”text” name=”url” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ /></p><p><small>What you have to say (Be civil, or it might be removed; comments with linksmight be held for moderation, just so you know):</small>
<textarea name=”comment” cols=”50″ rows=”10″ tabindex=”4″></textarea><input name=”submit” type=”submit” id=”submit” tabindex=”5″ value=”Submit Comment” />
<input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />
</p>
<?php do_action(‘comment_form’, $post->ID); ?>
<?php live_preview(); ?>
<?php endif; ?>
‘</form>Any help you can give would be most appreciated — thanks!
Andrew