[wp-hackers] File inclusion in WP theme

Jennifer Hodgdon yahgrp at poplarware.com
Thu May 8 12:34:41 GMT 2008


dtc4ever wrote:
> The text files contain transcriptions of
> guitar tabs so basically, they are text snippets that I'd like to
> insert in the content section of my theme.

My suggestion would be to write a short plugin (or you could put this 
in the functions.php file of your theme, but a plugin is more portable 
if you want to change themes), which would insert the guitar tab into 
the post content. Something like this:

*****
add_filter( 'the_content', 'guitartabs_insert_tab' );

function guitartabs_insert_tab( $pcontent ) {
    global $id;

    $dir = ABSPATH . 'wp-content/yourtranscriptdir/';

    // figure out which text file you need by post ID
    // or post content, and add it to $pcontent,
    // perhaps inside a set of <pre> </pre> tag?s


    return $pcontent;
}
*****
     --Jennifer

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com

Drupal/WordPress Sites, Themes, Modules/Plugins
Custom Web Programming, Web Databases
PHP, Perl, MySQL, JavaScript, XML, AJAX



More information about the wp-hackers mailing list