Skip to:
Content
Pages
Categories
Search
Top
Bottom

Plugin: Using the strike tag

  • Greets:

    Is there any reason (ie security?) why not to use the strike tag within out bbpress install?

    Thanks,

    -drmike

Viewing 20 replies - 1 through 20 (of 20 total)
  • No reason, it just wasn’t added as one of the default tags. A quick plugin should allow it pretty easily though. Let me see how easy it would be to write…..brb

    Trent


    chrishajer
    Participant

    @chrishajer

    waiting ….

    :)

    Here is a little plugin for allowing strike!

    <?php

    function allow_strike_as_allowed_tags( $tags ) {

    $tags['del'] = array();

    return $tags;

    }

    add_filter( 'bb_allowed_tags', 'allow_strike_as_allowed_tags' );

    ?>

    Just save it as allow-strike.php and toss it in your /my-plugins/ folder.

    Trent


    chrishajer
    Participant

    @chrishajer

    I was wondering how you were going to do this one Trent. <strike> is not valid XHTML is it? Although it still renders properly, at least in FF 1.5.0.9 I think you need to do something like this now:

    .strike {

    text-decoration: line-through;

    }

    or inline (bad, bad)

    style="text-decoration: line-through"

    Also, I can’t remember if the <del> tag is XHTML compliant or not. Maybe you could just change the strike to del and call it a day?

    IF <del> tag is XHTML compliant, then we should just use that. I didn’t even realize the strike tag was not compliant. With all the smart browsers out there now, the entire compliance things bugs me a bit……

    Trent

    I dug around the bb-includes last night and found where the allowed_tags (or whatever it was called) function was and just added it.

    I’m using bbpress as a checklist and wanted the tag to mark off stuff when issues were completed.

    del? Didn’t think of that. Well, they’re both in there and Igotta admit XHTML isn’t high on my list for a support forum.

    Thanks,

    -drmike

    edit: Could have sworn we had them on the wp.com forums…

    The plugin I listed above now is using <del> as the tag. Simple enough to change to <strike> if you want that regardless of standards. It is just changing the word! Use at your own discretion as it is an easier solution than constantly changing the core file of formatting-functions.php

    Any suggestions on getting this or other tags included using XHTML, please let me know because I would be a bit lost on that issue! Thanks Chrishajer for pointing that out though, I just am XHTML stupid….

    Trent

    I knew I had seen them over in wp.com land.

    They’re in the allowed tag list.

    Link

    I thought I was going bonkers. :)

    Wouldn’t that be the allowed tags in WordPress, not bbPress forum though right drmike? ;)

    Trent

    But how to add <strike> AND italic? (I miss italic to in the basic install)

    This is the plugin for strike (used as “del” for compliance reasons, but you can change the code from del to strike if you want. Creating a new plugin and changing it it “i” and italics in the name versus strike will do that one as well.

    Trent

    Ahh ok, I want them in 1 plugin file though… also think these two should be standard :D

    This works ok:

    <?php
    function allow_strike_as_allowed_tags( $tags ) {
    $tags['strike'] = array();
    return $tags;
    }
    add_filter( 'bb_allowed_tags', 'allow_strike_as_allowed_tags' );

    function allow_italic_as_allowed_tags( $tags ) {
    $tags['i'] = array();
    return $tags;
    }
    add_filter( 'bb_allowed_tags', 'allow_italic_as_allowed_tags' );
    ?>


    LMD
    Participant

    @louisedade

    Uh, you don’t need to create separate functions for each tag! You are only extending the contents of an array.

    I use this home-grown plugin for all the extra tags I want to add (edited for readability).

    <?php
    // Allow extra html tags, even depreciated
    function allow_extra_tags( $tags )
    {
    $tags['a'] = array(
    'href' => array(),
    'title' => array(),
    'rel' => array(),
    'target' => array()
    );
    $tags['i'] = array();
    $tags['b'] = array();
    $tags['del'] = array();
    $tags['strike'] = array();
    $tags['img'] = array(
    'src'=> array(),
    'alt' => array(),
    'width' => array(),
    'height' => array()
    );

    return $tags;
    }
    add_filter( 'bb_allowed_tags', 'allow_extra_tags' );
    ?>

    Much simpler and easier to maintain.

    “But how to add <strike> AND italic? (I miss italic to in the basic install)”

    Wha’? Italic is totally there!

    Just use

    <em> </em>

    That’s your basic XHTML compliant italic, just like <strong> is the compliant bold. They’re both in by default.

    Or did I miss something?!

    OMG I totaly looked over that <em>

    Yep it works

    This is why the Quicktags plugin is nice – no need to memorise :D

    Shame there is no demo or image of how it looks like :)

    No images here, but you can see it on my forum. Here’s a thread: http://forums.loinhead.net/topic/the-purty-image-associator/page/2?replies=52

    A little CSS styling applied to make them look flat, but I can easily share that. Otherwise they look like grey slightly bulging standard buttons.

    Thx

Viewing 20 replies - 1 through 20 (of 20 total)
  • You must be logged in to reply to this topic.
Skip to toolbar