stevechatterton
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Looping structures in posts confusing Post IDYour hunch paid off. That’s awesome. Thank you so much!
Forum: Fixing WordPress
In reply to: Looping structures in posts confusing Post IDI started commenting out WordPress functions one by one to isolate the one that may or may not be causing my problem. I got it down to the point where every function was commented out and the page still displays meta data & comments from the last post called by the while loop.
So I’m guessing the very nature of the while loop is flawed in this case. I’m off to to some of that web-based research, but I’ll check back to see if anyone has any advice.
Thanks.
Forum: Fixing WordPress
In reply to: Looping structures in posts confusing Post IDThx t31os_ – it didn’t fix the problem, but I see how it’s easier to read.
I had a problem once with display issues when I called a variable in the middle of an echo statement and the only way to resolve it was to bust everything into its own isolated echo. I don’t know why, but it did work, and since that day I’ve been overly cautious.
Forum: Fixing WordPress
In reply to: List categories of a specific postAnswered my own question by visiting this page:
http://www.scriptygoddess.com/archives/2004/09/21/php-remove-an-element-from-an-array/I guess I’m marking as resolved now.
Forum: Fixing WordPress
In reply to: List categories of a specific postThat does work much better, but because my site’s a bit of a pain in the butt, I’m going to throw another wrench into the works…
There are 2 category IDs I want to exclude, BUT they are the main parent categories, fiction & non-fiction, for all other books. If I put in a category__not_in statement after the category__in statement I loose everything.
Is there a simple way to take the array once it’s passed to the function and say drop these 2 values but keep all the others?
Forum: Fixing WordPress
In reply to: List categories of a specific postThanks, I’ll have to give that a whirl when I’ve got some time.
Forum: Fixing WordPress
In reply to: List categories of a specific postalchymyth – that doesn’t seem to be working. It seems to be passing every category, not just the post specific ones.
Here’s my call from within the post:
<?php $bookID = $post->ID; $inCats = wp_get_post_categories($post->ID); // alchymyth's suggestion listRelated($inCats, $bookID); ?>And here’s my function:
function listRelated($inCats, $bookID) { $args = array( 'category__in' => $inCats, 'post__not_in' => $bookID, 'orderby' => 'modified', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'caller_get_posts'=> 1 ); $my_query1 = new WP_Query($args); while ($my_query1->have_posts()) : $my_query1->the_post(); $do_not_duplicate1 = $post->ID; ...Any other ideas how to auto-pass the categories?
Forum: Fixing WordPress
In reply to: List categories of a specific postI haven’t, but I’m going to try to do this without upping my overhead. That, and the fact that I’m so darn close.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?Well, if you write a book of your coolest WP tricks I’ll be first in line to buy it.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?Whatever they’re paying you, it’s not enough!
I was trying to declare it within the function (at the advice of a rather old book). But that, indeed, does work, and now I’m going to stop bothering you for a good long while. Know that I’m eternally grateful & have yourself a great weekend.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?Any chance I could coax you into posting your revised code, because I seem to get an error with everything I try.
By the way, I do really appreciate all the help. Something’s just not clicking here.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?Here’s the error msg when we try that:
Parse error: syntax error, unexpected T_GLOBAL in /***/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 6Maybe globalization isn’t the issue.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?I know we’re getting closer to a solution, but I’m getting one of those pesky fatal errors:
Fatal error: Call to a member function get_col() on a non-object in /***/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 7Do I need to globalize something somewhere first perhaps?
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?t31os_
The intention is to have 1 letter per page when it displays, and there will likely be some pagination involved when we get more titles.
Ideally I’d like to do it all in one page that passes variables, likely through the URL – /books?start=A&end=B or something like that.
MichaelH – I’ll look into that wpdb stuff – it looks mighty complicated to my eyes, but maybe if I start at the beginning & read every word it’ll start coming together. I’m a little rusty on coding DB calls, and have virtually no experience with inner joins, but I’ll give it a whirl.
Forum: Fixing WordPress
In reply to: WP_Query with RegEx: Is it possible? Custom Fields better?Yes, we want posts listed in order by a custom field, but grouped & separated alphabetically.
We want to have A-Z navigation across the top:
A – B – C – D – etc.
Clicking on A would give you any author with a last name beginning with A, and so on down the line.
It’d be a really handy way for users to browse a bunch of books.