bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Plugin: Using the strike tag

(21 posts)
  • Started 1 year ago by drmike
  • Latest reply from Null
  • This topic is not a support question
  1. Greets:

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

    Thanks,
    -drmike

    Posted 1 year ago #
  2. 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

    Posted 1 year ago #
  3. waiting ....

    :)

    Posted 1 year ago #
  4. 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

    Posted 1 year ago #
  5. 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?

    Posted 1 year ago #
  6. 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

    Posted 1 year ago #
  7. 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...

    Posted 1 year ago #
  8. 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

    Posted 1 year ago #
  9. 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. :)

    Posted 1 year ago #
  10. Wouldn't that be the allowed tags in Wordpress, not bbPress forum though right drmike? ;)

    Trent

    Posted 1 year ago #
  11. But how to add <strike> AND italic? (I miss italic to in the basic install)

    Posted 1 year ago #
  12. 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

    Posted 1 year ago #
  13. Ahh ok, I want them in 1 plugin file though... also think these two should be standard :D

    Posted 1 year ago #
  14. 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' );
    ?>
    Posted 1 year ago #
  15. 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.

    Posted 1 year ago #
  16. "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?!

    Posted 1 year ago #
  17. OMG I totaly looked over that <em>
    Yep it works

    Posted 1 year ago #
  18. This is why the Quicktags plugin is nice - no need to memorise :D

    Posted 1 year ago #
  19. Shame there is no demo or image of how it looks like :)

    Posted 1 year ago #
  20. 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.

    Posted 1 year ago #
  21. Thx

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.