ericmcgregor
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: using wordpress rss to generate xspf playlist!Ok! you know what, it is working. However, now it’s repeating the address to the enclosure several times. 🙁 I’ll keep diggin. but real progress! Thanks!
Forum: Fixing WordPress
In reply to: using wordpress rss to generate xspf playlist!huh. I am really missing something. I’m sorry, I’m not a very good programmer at all. It’s really frustrating because conceptually i get how it should work, but then I can’t make it happen.
I put the above code in playlist.php file with a call to the wp-blog-header. I started the loop and am accessing the file like this: playlist.php?p=8
Nothing happens. I looked at the rss2 file… here is where i think the problem is:
I’m not specifically putting this file in a custom field as an eclosure. I’m relying on wordpress to autodetect the LINK in the post and then do all of it’s magic. so I am not manually storing this as an eclosure. I’m trying to make it as simple as possible, and I’m using the upload -> send to editor fuction to put my podcast in the post.
Does that make sense? am I approaching this completely wrong.
Forum: Fixing WordPress
In reply to: Enclosure Feild Output as a LinkHi,
This is exactly what I want to do, but I can’t get either of your solutions to work. are you both using 1.5?Orin, what i’m trying to do is dynamically build a xspf playlist based on the linked enclosure in my post. I’m then trying to link a flash mp3 player to that playlist.
So right now I have a seperate playlist.php file that I’m trying to load with the url of the mp3 enclosure attached to my post. I’m not having a lot of luck getting your solutions to work. any help is appreciated.
Forum: Fixing WordPress
In reply to: using wordpress rss to generate xspf playlist!Ok. I’m having some trouble getting this to work. I’ve made a standalone .php file with the following:
<?php
/* Short and sweet */
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');$custom_fields = get_post_custom();
if( is_array( $custom_fields ) ) {
while( list( $key, $val ) = each( $custom_fields ) ) {if( $key == 'enclosure' ) {
if (is_array($val)) {foreach($val as $enc) {
$enclosure = split( "n", $enc );// your output here instead of the following
echo "hello";
echo "url=".trim( htmlspecialchars($enclosure[ 0 ]) );
echo "length=".trim( $enclosure[ 1 ] );
echo "type=".trim( $enclosure[ 2 ] );}
}
}
}
}?>
I’m not getting anything returned on the page. Do I need to run this inside the loop? Should I actively try and query a post when I access it (playlist.php?p=8)?
I’m trying to build the address of the enclosure into a xspf type playlist. Thanks!
Forum: Fixing WordPress
In reply to: using wordpress rss to generate xspf playlist!Wow, this looks really promising! I’m going to really look at this tomorrow and let you know how it works out.
I plan on making a seperate .php file that will build a valid .xspf playist document based on info from the loop. I’m then going to hook the xspf web music player into that play list.
Forum: Plugins
In reply to: modification to wp_list_pages: current_page_itemheh. come on you guys! I believe in you. 😉
Forum: Fixing WordPress
In reply to: Pages – using the loop and query_postsThanks david. I’m not sure what that means though. I’m not a programmer, and so my level of understanding is very basic. Maybe you could provide an example?
Forum: Fixing WordPress
In reply to: Pages – using the loop and query_postsOk, I figured it out!
On this page: http://codex.wordpress.org/The_Loop
Scroll down, you’ll see this:<?php $my_query = new WP_Query(‘category_name=special_cat&showposts=10’); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<!– Do special_cat stuff… –>
<?php endwhile; ?><?php rewind_posts(); ?>
What you want to do is build your own query, then reweind posts to reset the query object so that list_pages doesn’t break.
Forum: Themes and Templates
In reply to: “On-state” for current page in navigationOk, perfect. I see what you’re saying now. I was running into a problem because I’m trying to get one of those pages to be the static home page. In that situation, it’s not displaying the current_page_item class. interesting.
Forum: Themes and Templates
In reply to: “On-state” for current page in navigationHrm… not sure I’m explaining this the right way.
the default output for the <?php wp_list_pages(‘title_li=’); ?> tag is this for every link: (sorry, i’m using brackets for the a link)
<li class=”page_item”>[a href=”http://www.mysite.com?page_id=4″ title=”About Page”]About[/a]
If I have 5 pages, they all end up with that exact same markup. Now if I’m page 4, the about page, for example, and I want that single page to have a different background in the navigation… I’m going to need to add an ‘onstate’ class to the releveant a link.
So wordpress will have to know that I am currently on page 4, and that since i’m on page 4, it needs to style the link to page 4 in the navigation differently by adding a class to the a tag.
I have been looking for plugins to do this, but i don’t see any. It’s pretty standard user interface stuff to want to have your navigation display like this. I’ve been poking around and trying to re-format the ‘template_functions_post’ file which contains the actual function i’m looking at:
function wp_list_pages($args = ”) {
parse_str($args, $r);
if ( !isset($r[‘depth’]) )
$r[‘depth’] = 0;
if ( !isset($r[‘show_date’]) )
$r[‘show_date’] = ”;
if ( !isset($r[‘child_of’]) )
$r[‘child_of’] = 0;
if ( !isset($r[‘title_li’]) )
$r[‘title_li’] = __(‘Pages’);
if ( !isset($r[‘echo’]) )
$r[‘echo’] = 1;$output = ”;
// Query pages.
$pages = & get_pages($args);
if ( $pages ) {if ( $r[‘title_li’] )
$output .= ‘<li class=”pagenav”>’ . $r[‘title_li’] . ‘- ‘;
// Now loop over all pages that were selected
$page_tree = Array();
foreach ( $pages as $page ) {
// set the title for the current page
$page_tree[$page->ID][‘title’] = $page->post_title;
$page_tree[$page->ID][‘name’] = $page->post_name;// set the selected date for the current page
// depending on the query arguments this is either
// the createtion date or the modification date
// as a unix timestamp. It will also always be in the
// ts field.
if ( !empty($r[‘show_date’]) ) {
if ( ‘modified’ == $r[‘show_date’] )
$page_tree[$page->ID][‘ts’] = $page->post_modified;
else
$page_tree[$page->ID][‘ts’] = $page->post_date;
}// The tricky bit!!
// Using the parent ID of the current page as the
// array index we set the curent page as a child of that page.
// We can now start looping over the $page_tree array
// with any ID which will output the page links from that ID downwards.
if ( $page->post_parent != $page->ID)
$page_tree[$page->post_parent][‘children’][] = $page->ID;
}
// Output of the pages starting with child_of as the root ID.
// child_of defaults to 0 if not supplied in the query.
$output .= _page_level_out($r[‘child_of’],$page_tree, $r, 0, false);
if ( $r[‘title_li’] )
$output .= ‘
‘;
}$output = apply_filters(‘wp_list_pages’, $output);
if ( $r[‘echo’] )
echo $output;
else
return $output;
}so somewhere in there I should be able to tell it, ‘if this is the current page’ then ‘output this class in the link’.
Thanks for your help people!
Forum: Themes and Templates
In reply to: Sort by custom value fields?This is EXACTLY what I need. I’m trying to order my posts based on a custom field called ‘order’ and I’m giving a numberical value of 1 through 10.
If somebody can please, please let me know if they figured this out and how to implement it i would really, really appreciate it.
Thanks!
Forum: Fixing WordPress
In reply to: Changing the order of postscan you please elaborate on ordering by the meta value?
Forum: Fixing WordPress
In reply to: Sort (alphabetize) posts by custom fieldOh, also, the posts I want are category specific. 😉
Interesting problem. I wish wordpress were better able to handle stuff like this. If I find anything I’ll be sure to post it up here.
Forum: Fixing WordPress
In reply to: Sort (alphabetize) posts by custom fieldHi, I’m having a very similar problem. I would like to numberically tag a post using the meta data, and then sort the posts by that field. That way, I can re-order the posts in the future instead of being constricted to the date they were posted.
Any thoughts on that? I’m not sure I’m understanding how the example above would work.
Thanks.
Forum: Fixing WordPress
In reply to: Help with the_date vs. the_timeHey, I had the exact same problem. Here’s what I did… It’s an ugly, ugly hack but it seems to work. I copied the_date function and then cut out the If statement at the top that prevented you from using the date more than once. Then, I copied this into an “extradate.php” file and included it at the top “require(‘extradate.php’);”.
<?php
function extra_date($d=”, $before=”, $after=”, $echo = true) {
global $id, $post, $day, $previousday, $newday;
$the_date = ”;if ( $d==” )
$the_date .= mysql2date(get_settings(‘date_format’), $post->post_date);
else
$the_date .= mysql2date($d, $post->post_date);
$the_date .= $after;
$previousday = $day;$the_date = apply_filters(‘the_date’, $the_date, $d, $before, $after);
if ( $echo )
echo $the_date;
else
return $the_date;
}?>
now i can call extra_date(); as much as I please.