• Hello,

    I’m looking for a tutorial explaining the process of creating a custom taf on wordpress.

    I’d like to render some custom html from a simple tag
    example :

    <music id=’14’ />

    which will render :

    <embed object flashMusicPlayer.swf source=”14.mp3″ …..>
    </embed>

    The code rendering the html is already done in my function
    getMusicCode (int $idMusic), in my php code

    I just need to know where to implement the filtering of the wordpress content to call my custom function

    thanks a lot if you have info

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter devoue

    (@devoue)

    note : I’m using WordPress 2.0

    Thread Starter devoue

    (@devoue)

    anyone ?

    Take a look at my My Tags plugin. It doesn’t allow for unique attributes (i.e. id=’14’), but with some mods one could get it to handle them:

    https://www.ads-software.com/support/topic/32984#post-186878

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    I just need to know where to implement the filtering of the wordpress content to call my custom function

    You can implement it almost anywhere you like, actually. Preferably in a plugin or in functions.php or something. Before your Loop executes, anyway.

    function your_function($content)
    {
    // $content contains the content of the actual post
    // you can modify content all you like and return it,
    // and that's how it's modified
    return $content;
    }
    // this adds your filter into the_content chain, so
    // that every post's content will get passed into
    // your function
    add_filter('the_content','your_function');

    A simple example:
    function add_giggity($content) {
    return $content." Giggity!";
    }
    add_filter('the_content','add_giggity');

    For your particular case, you’ll probably want to have your function do a regexp match on the incoming content and replace that text with your embed text as appropriate. I’d look into the preg_match and preg_replace PHP functions if I were you. Very handy.

    Thread Starter devoue

    (@devoue)

    thanks guys

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘simple guide to create custom tag’ is closed to new replies.