marksbrain
Forum Replies Created
-
Forum: Plugins
In reply to: What Features Would You Want In An Event Manager?Is the date system just handled by future-dating posts? Or are there new values (in custom fields or something) assigned to the post? I ask because I’d like to use it to back-date posts that cover historical events that took place before 1970 (which is the last year that PHP or MySQL can handle.)
I’m trying to use WordPress to make a timeline of historical events, where a post describing something that took place on June 1 1912 would automatically be ordered after something that took place on January 2 1543 and before something that took place on June 2 1912.
Could EventPress accomplish that?
Forum: Themes and Templates
In reply to: Sort by custom value fields?In the discussion section of the codex page mentioned above, there’s this interesting tidbit:
If you just want to pull the custom field value
out and use it however you want, try this in your
template (within The Loop):<?php
foreach(get_post_custom_values(‘music’) as $song) {
echo $song;
} ?>Make sure the argument (i.e. custom field key) passed
to get_post_custom_values()is the correct one.If you didn’t want to echo it (because you don’t want to see it, necessarily, just have it to order by) would it be possible to cut that part and run the rest of that function just as a way of making the value associated with that custom field key available for the orderby function? Would doing that allow you to set something to orderby=meta_value?
Does any of this make any sense? Or am I going crazy?
Forum: Themes and Templates
In reply to: Sort by custom value fields?Okay, so I think you wouldn’t really need to use the Get Custom Field Values Plugin, because it seems there are now lots of ways to get at custom fields without using a plugin, as described here.
In fact, that page tells us something very interesting:
The PostMeta information is stored in a new table, $wpdb->postmeta. This table has four fields:
meta_id: A unique id for each entry
post_id: The ID of the post for this metadata
meta_key: The name of the ‘key’
meta_value: The value associated with the keyThe values from this table are pulled into a structured multi-dimensional array called $post_meta_cache, just after the $posts array is fetched in wp-blog-header.php. This variable will only contain values for the list of posts fetched for the current page build.
Cool. So, since the information is already there, it seems there would have to be a way to order by the meta_values assocated with a given meta_key. Right?
But what is it?
I think a lot of people would really dig it if we could come up with a way to do this. It would allow you to sort things in all kinds of useful ways.
In a site with reviews about music, you could have a meta_key:genre and sort by the meta_values:rock, hip hop, folk, blues, etc.
In a site about future or past events, you could have meta_keys: Year, month, and day; and sort by the meta_values assigned to them.
Figuring this out would do a lot to make WordPress into even more of a mult-functional CMS. Custom fields have got to be more useful than just telling the world your mood. Anyone care to help out?
Forum: Themes and Templates
In reply to: Sort by custom value fields?Very groovy.
So, is there any way to change the “orderby=title” to “orderby=customfield,” or something like that?
(I’m dying for a little community support; I’ve been trying things on my own and getting nowhere…Please help a brother out!)
Forum: Themes and Templates
In reply to: Sort by custom value fields?Okay, I’ve done some further research and I’m thinking there must be a way to get this to work using some combination of this type of code…
{
$q[‘orderby’] = ‘????’;
$q[‘order’] = ‘ASC’;
}(which I found here.)
…and the Get Custom Field Values Plugin
But how it would actually work is beyond me.
Anyone who knows more than me care to give a brother a hand?
Forum: Themes and Templates
In reply to: Sort by custom value fields?Bueller?
Forum: Themes and Templates
In reply to: Sort by custom value fields?I wonder that as well. My hunch is that the answer is no, because if it were possible everyone would be doing it and there would be some record of it on the Internet. (I’ve searched!) I think it doesn’t work because custom fields are metadata or something like that.
Anyone smarter than Xander and I care to weigh in?
Forum: Fixing WordPress
In reply to: Links cause unwanted line breaksI wasn’t hitting return, but I was hand coding the link (directly typing in the a href=”…)instead of highlighting the word I wanted to make a hyperlink and using the “link” button above the edit text field. When I went back and used that button, everything straightened itself out.
Is it not a good idea to just type code in yourself? I’m a fast typer and often find this easier than letting the blog software write the code for me; and the end result looks exactly the same in the edit text field. But I guess if it doesn’t work, it doesn’t work.
(Not sure what d_may’s most is supposed to mean…)