WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] image tags - 'you may use' instruction (8 posts)

  1. Myf
    Member
    Posted 7 years ago #

    Hello.

    In the comments box the instruction 'You may use' appears, followed by various HTML tags.

    My site is all about users posting images in their replies, which is all dandy - but I can't work out how to add 'IMG src' to this list of allowed tags. Where would I edit that?

    With great thanks,

    Myf

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    That would be in the $allowedtags array in kses.php.

    You would need to add:
    'img' => array ('src' => array (), 'alt' => array ())
    to that array.

    Then you'd need to add the allowed tag to your theme so they know they can use it.

    Alternatively, you could create some kind of filter which would let them use BB style img tags, or whatever other format you wanted.

  3. Myf
    Member
    Posted 7 years ago #

    Thanks so much for this! But what I meant was, where do I add it to my theme to let them know they can use it. I know it's silly, but I just can't find the text...

  4. jessibird
    Member
    Posted 7 years ago #

    Try looking in your theme's comments.php file. It should be there.

  5. Myf
    Member
    Posted 7 years ago #

    Thanks. Here's what I suppose is the pertinent part in the comments file:

    You may use
    /<?php echo allowed_tags();?>
    in your comment./

    Which I assume is calling the text from elsewhere. Can you tell me where?

  6. rudolf45
    Member
    Posted 7 years ago #

    The very first line in Otto42's post:

    That would be in the $allowedtags array in kses.php.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Huh. I didn't even know about that function.

    Okay, so you don't have you change your theme then. It's automatic. Just change the allowed tags array like I described and see if that works.

    Or just stick this into your wp-config.php file (despite what the kses.php file says in it, the my-hacks.php file won't work for this application):

    define('CUSTOM_TAGS', true);
    $allowedposttags = array ('address' => array (), 'a' => array ('href' => array (), 'title' => array (), 'rel' => array (), 'rev' => array (), 'name' => array ()), 'abbr' => array ('title' => array ()), 'acronym' => array ('title' => array ()), 'b' => array (), 'big' => array (), 'blockquote' => array ('cite' => array ()), 'br' => array (), 'button' => array ('disabled' => array (), 'name' => array (), 'type' => array (), 'value' => array ()), 'caption' => array ('align' => array ()), 'code' => array (), 'col' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'span' => array (), 'valign' => array (), 'width' => array ()), 'del' => array ('datetime' => array ()), 'dd' => array (), 'div' => array ('align' => array ()), 'dl' => array (), 'dt' => array (), 'em' => array (), 'fieldset' => array (), 'font' => array ('color' => array (), 'face' => array (), 'size' => array ()), 'form' => array ('action' => array (), 'accept' => array (), 'accept-charset' => array (), 'enctype' => array (), 'method' => array (), 'name' => array (), 'target' => array ()), 'h1' => array ('align' => array ()), 'h2' => array ('align' => array ()), 'h3' => array ('align' => array ()), 'h4' => array ('align' => array ()), 'h5' => array ('align' => array ()), 'h6' => array ('align' => array ()), 'hr' => array ('align' => array (), 'noshade' => array (), 'size' => array (), 'width' => array ()), 'i' => array (), 'img' => array ('alt' => array (), 'align' => array (), 'border' => array (), 'height' => array (), 'hspace' => array (), 'longdesc' => array (), 'vspace' => array (), 'src' => array (), 'width' => array ()), 'ins' => array ('datetime' => array (), 'cite' => array ()), 'kbd' => array (), 'label' => array ('for' => array ()), 'legend' => array ('align' => array ()), 'li' => array (), 'p' => array ('align' => array ()), 'pre' => array ('width' => array ()), 'q' => array ('cite' => array ()), 's' => array (), 'strike' => array (), 'strong' => array (), 'sub' => array (), 'sup' => array (), 'table' => array ('align' => array (), 'bgcolor' => array (), 'border' => array (), 'cellpadding' => array (), 'cellspacing' => array (), 'rules' => array (), 'summary' => array (), 'width' => array ()), 'tbody' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'td' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'textarea' => array ('cols' => array (), 'rows' => array (), 'disabled' => array (), 'name' => array (), 'readonly' => array ()), 'tfoot' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'th' => array ('abbr' => array (), 'align' => array (), 'axis' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'colspan' => array (), 'headers' => array (), 'height' => array (), 'nowrap' => array (), 'rowspan' => array (), 'scope' => array (), 'valign' => array (), 'width' => array ()), 'thead' => array ('align' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'title' => array (), 'tr' => array ('align' => array (), 'bgcolor' => array (), 'char' => array (), 'charoff' => array (), 'valign' => array ()), 'tt' => array (), 'u' => array (), 'ul' => array (), 'ol' => array (), 'var' => array () );
    $allowedtags = array (
    'a' => array ('href' => array (), 'title' => array ()),
    'abbr' => array ('title' => array ()),
    'acronym' => array ('title' => array ()),
    'b' => array (),
    'blockquote' => array ('cite' => array ()),
    'code' => array (),
    'em' => array (),
    'i' => array (),
    'img' => array ('src' => array (), 'alt' => array ()),
    'strike' => array (),
    'strong' => array (),
    );
  8. Myf
    Member
    Posted 7 years ago #

    Undying thanks - this worked beautifully. I am sorry for being such an ignoramus and I thank people like you for providing instructions I can follow.

Topic Closed

This topic has been closed to new replies.

About this Topic