Title photo
frugal technology, simple living and guerrilla large-appliance repair
Wed, 13 Jun 2012

WordPress: What am I doing wrong?

OK, here's the deal. In Ode I can get any kind of output I want through the project's infinitely flexible theming. In Movable Type I can create any number of custom Javascript output files that draw on the blogging system's database.

So how do I do this in WordPress? I'm looking into child themes (I confess that I've -- horror of horrors -- modified the main theme in a WordPress blog), but I need EXTRA theming. What I need is the ability to tap the blog database for custom HTML output that includes only the elements I want with accompanying HTML so I can display that output on other sites.

It's so easy to do this in Ode and Movable Type. Why is it so hard (or seemingly so) in WordPress?

So far I've been able to hack a custom PHP script that provides exactly the output I want, and if I drop it in the theme directory and then create a WordPress Page using it as template, it all works. But this arrangement won't allow me to parse the output by tag: I would need to create a separate PHP script for each tag (and I haven't yet figured out how to parse by tab in the PHP, but I imagine that is easy enough).

If I could do this as a wholly separate but co-existing WordPress theme, I figure I could get the output I want and parse it using tags in the URL.

Right now here is my code (and looking at it right now, it's pretty obvious that I can pull the <div> tags and take care of those on the site at which I'm embedding this code):

<?php
/*
Template Name: Last four entries - thumbnail image and title only - HTML
*/

 = 5;

 = query_posts('showposts='.);

 =  - 1;

?>

<div id="media_feed">

    <?php foreach ( as ) { ?>

        <a href="<?php echo get_permalink(->ID); ?>">
            <?php echo get_the_post_thumbnail(->the_post_thumbnail, 'thumbnail'); ?>
                <div>
                <?php echo get_the_title(->ID); ?>
                </div>
         </a>
<?php } ?>


</div>

My PHP is at the wholly hackish stage. As I say above, the output of this file does exactly what I want, but I'd like it to be baked further into the system so I can vary the output by WordPress tag. And as I also say above, this would be much, much easier in Ode and "regular" easier in Movable Type (which easily allows for custom Javascript output).

I can't believe that developers don't want custom output generated from the WordPress database that is different than what they offer in their regular blog output.

Note: I tried to do this with RSS parsed through Feedburner, but the way this particular site is set up, the RSS doesn't contain the right elements for what I want to get out of Feedburner, and custom output generated by the blog itself is a lot more elegant (if it works).

Another note: Theming flexibility was a major reason for me to choose Ode as my blogging platform.