Peter Boosten
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Questions about using WordPress as CMSThat’s a clear view of what the customer wants, but requires some thinking ahead.
Based on the above, I would create an empty products page, with empty category pages underneath, and the products themselves as subpages of the (empty) category pages.
All variable info, like pricing, images, possibly location would then go into custom fields.
From that structure you could easily expand the catalog, and make a design around that. The pages, also the empty ones, are then shaped by page templates.
To have an idea: this page is an empty page called books, filled with the info from the custom fields of its subpages. The subpages themself hold the information displayed on the right (if you click one of the books), things like author and such are custom fields.
Peter
Forum: Themes and Templates
In reply to: Different backgrounds on every categoryMaybe it’s much easier than that: if your theme uses post_class() to fill the class for a post, then also a class exists per category.
This class can then be used to create some custom css for.
If you supply an URL, we could have a look.
Peter
Forum: Themes and Templates
In reply to: PHP problem with custom fields inside loophuh?!? Why non-alcoholic? 😉
Peter
Forum: Themes and Templates
In reply to: PHP problem with custom fields inside loopMy mistake: lose the urlencode().
echo "<a class='cssthingie' href='". get_permalink($post->ID) . "'>text in norwegian</a>";Peter
Forum: Themes and Templates
In reply to: I need more space for my links in sidebarHow can I do this?
For starters: provide us your URL
Peter
oke, let’s examine this:
the equation is (previous_month + (year_of_previousmonth * 12)) should be equal to (current_month + (year_of_currentmonth * 12)) -1
For November if this year that would be:
11 + (2009 * 12) = 24119December:
12 + (2009 * 12) = 24120Which is exactly one more than November 🙂
Why this construct? Try to write a query for January, summing the values of December of the previous year.
So let’s examine the previous statement, since I might have gone wrong on the parenthesis and such, and I did, or so it seems (just before the first year function should be another parenthesis)
SELECT SUM($wpdb->postmeta.meta_value)
FROM $wpdb->postmeta, $wpdb->posts
WHERE $wpdb->postmeta.meta_key=’Meters’
AND $wpdb->postmeta.post_id=$wpdb->posts.id
AND (month($wpdb->posts.post_date) + (year($wpdb->posts.post_date) * 12)) = (month(now()) + (year(now()) * 12) – 1)Peter
Forum: Themes and Templates
In reply to: PHP problem with custom fields inside loopoh yeah, of course. the_permalink is meant to do all the xhtml work for you.
Use this function instead:
urlencode(get_permalink($post->ID))Peter
Forum: Themes and Templates
In reply to: PHP problem with custom fields inside loopecho "<a class='cssthingie' href='". the_permalink() . "'>text in norwegian</a>";Since you’re already in an php session (the echo command), you don’t need to start one again.
Peter
Forum: Themes and Templates
In reply to: Image Overlaps Bottom Border?add
overflow: hidden;to .postPeter
Apologies, had been occupied elsewhere…
//Connect to DB and calculate the sum of meters run in previous month
$meter_last_month = $wpdb->get_var($wpdb->prepare(“
SELECT SUM($wpdb->postmeta.meta_value)
FROM $wpdb->postmeta, $wpdb->posts
WHERE $wpdb->postmeta.meta_key=’Meters’
AND $wpdb->postmeta.post_id=$wpdb->posts.id
AND (month($wpdb->posts.post_date) + year($wpdb->posts.post_date) * 12)) = (month(now()) + (year(now()) * 12) – 1)”));Peter
Well, I have to admit that I only tested the SQL statement, not the actually call from WordPress.
Is this what you wanted?
You now could embed this function in a shortcode and call it whenever you want.
One tip: if you always want to collect the data of a previous month, I suggest calculating the previous month like this:
WHERE (month(post_date) + year(post_date) * 12)) = (month(now()) + (year(now()) * 12) – 1)
Peter
Forum: Themes and Templates
In reply to: Page Template not being appliedHave you checked if another template exists for this page, like pagename.php, page-slug.php or page-id.php (change pagename, slug and id accordingly)?
Since I actually have no idea where the page template is in the hierarchy, this could be the problem.
Peter
Forum: Themes and Templates
In reply to: *sigh*internet explore,r sort of odd oneOke, after some reading up I’ve learned that you need to do strict xhtml, not transitional, to have IE7 support fixed positioning.
For instance this article.
That might be your problem.
Peter
Well, it’s not really, you only need to get your query right:
you have to select the id’s from wp_posts where post_date matches your time frame, say a month, and use these id’s to select from the wp_postmeta table:
select sum(wp_postmeta.meta_value) from wp_postmeta,wp_posts where wp_postmeta.meta_key=’Meters’ and wp_postmeta.post_id=wp_posts.id and month(wp_posts.post_date)=12 and year(wp_posts.post_date)=2009;
Untested, but should do the trick.
EDIT: actually tested 🙂
Peter
Same response: 😉
Hmmm, Custom Fields are stored in wp_postmeta table, linked to post_id’s.
I guess it’s possible to query this table for all those values if you know what posts they are referring to.
Look at this page for some examples.
Peter