Forums

[Plugin: Custom Field Template] Issue with drop down html output (5 posts)

  1. solidnuts
    Member
    Posted 2 months ago #

    Hi, I'm trying to use the drop down feature so i can selct from 3 options with the value being html, here is what i'm using:

    [licence]
    type = select
    value = <a rel="nofollow" href="http://creativecommons.org/licenses/by/3.0/">Attribution (Creative Commons)</a>
    default =

    and this is the the result i get

    <a rel=\"nofollow\" href=\"http://www.gnu.org/copyleft/gpl.html\" target=\"_blank\">General Public License</a>

    so it seems like it adds forword slash's at every html quotation mark

    any idea how to fix this please?
    Thanks

  2. proximity2008
    Member
    Posted 2 months ago #

    Hi Solid,

    You'd have to use the code section in the CFT.

    [licence]
    type = select
    code = 0

    Then in the Code 0 area:

    $values = array();
    $values[] ='<a rel="nofollow" href="http://creativecommons.org/licenses/by/3.0/">Attribution (Creative Commons)</a>';
    $values[] ='<a rel="nofollow" href="http://creativecommons.org/licenses/by/3.0/">Second Option</a>';
    $values[] ='<a rel="nofollow" href="http://creativecommons.org/licenses/by/3.0/">Third Option</a>';

    This should do it.
    Have a nice day.

  3. solidnuts
    Member
    Posted 2 months ago #

    Thank you so much for your help.

  4. ddecort
    Member
    Posted 1 month ago #

    How would I set the default of a textfield to be an image with a link? Right now it escapes the quotes with slashes, so the default isn't working html.

    Here is my original example:

    [Marketing Area 1]
    type = textarea
    rows = 4
    cols = 40
    tinyMCE = true
    htmlEditor = true
    default = <img class="size-full wp-image-98 alignnone" style="border: 0pt none; margin: 0px;" title="marketing1" src="http://www.markettrendsignal.com/wordpress/wp-content/uploads/marketing1.jpg" alt="marketing1" width="741" height="204" />
    mediaButton = true

    That returned as the default in the page editor:

    <img class="\"size-full" style="\" title="\"marketing1\"" src="\" alt="\"marketing1\"" width="\"741\"" height="\"204\"" />

    which obviously won't work.

    I then tried putting that in the "php code", "#0" area:

    $value = <img class="size-full wp-image-98 alignnone" style="border: 0pt none; margin: 0px;" title="marketing1" src="http://www.markettrendsignal.com/wordpress/wp-content/uploads/marketing1.jpg" alt="marketing1" width="741" height="204" />

    and updated my template to this:

    [Marketing Area 1]
    type = textarea
    rows = 4
    cols = 40
    code = 0
    tinyMCE = true
    htmlEditor = true
    default = $value
    mediaButton = true

    But it just returns "$value" in the editor.

    I know i'm missing something here and am just guessing at this point. The example for the type = select doesn't seem to apply to setting the default for a text field.

    Any help is greatly appreciated.

  5. Hiroaki Miyashita
    Member
    Posted 1 month ago #

    Hi ddecort,
    Please update the plugin to the latest version 1.4.3. I fixed the quotation problems. You do not need to struggle with the php code any more. Just set the default attribute. Thanks.

Reply

You must log in to post.

About this Topic