• Resolved Adz

    (@adz)


    Hi,

    I’m using CFT along with the Simple Post Template plugin to simplify video posts. In the template, I have:

    [VideoID]
    type = text
    size = 20

    For some reason, when I use [cft key=VideoID] in my post, it outputs
    <ul><li>abc123</li></ul> where “abc123” is the value of VideoID. I’ve tried using insertTag = false and singleList = false but I can’t get rid of the markup.

    The stupid thing is that I had it working up until a few hours ago. All I did was update WP to 2.9.2 and delete all my old posts, now I can’t get it to strip out the html markup.

    Any help?

    https://www.ads-software.com/extend/plugins/custom-field-template/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Adz

    (@adz)

    Okay, it stores the values in arrays, which is why it lists the output rather than just a string.
    So, I tried a rough hack to create a new option called stripTags and put:

    if ( $val['stripTags'] == true ) :
    $replace_val = trim(strip_tags($replace_val));
    endif;

    after

    if ( $val['singleList'] == true ) :
    $replace_val = '<ul><li>' . $replace_val . '</li></ul>';
    endif;

    in custom-field-template.php but that didn’t do anything.

    So I just added

    $output = trim(strip_tags($output));

    before the return in:

    if ( $metakey ) :
    			$metavalue = $this->get_post_meta($post_id, $key, $single);
    			if ( is_array($metavalue) ) :
    				$output = '<ul>' . "\n";
    				foreach ( $metavalue as $val ) :
    					$output .= '<li>' . $val . '</li>' . "\n";
    				endforeach;
    				$output .= '</ul>' . "\n";
    			else :
    				$output = $metavalue;
    			endif;
    			$output = trim(strip_tags($output));
    			return $output;
    		endif;

    I know there’s a simpler way without changing the code, because I’ve done it before. I just can’t figure it out :s

    Same problem here.

    I’ve used Adz’s solution but like he said there must be a simpler one.

    Hope Hiroaki can help us.

    Awesome plugin btw!

    I simply changed

    if ( $val['singleList'] == true ) :
    $replace_val = '<ul><li>' . $replace_val . '</li></ul>';
    endif;

    for

    if ( $val['singleList'] == true ) :
    $replace_val = '' . $replace_val . '';
    endif;

    Dirty, but effective ??

    Thread Starter Adz

    (@adz)

    @elseudomini.net – I was thinking of doing that, but decided against it because I wasn’t too keen on the idea of removing functionality. But as you said, it works.

    guys, to me elseudomini.net’s hack doesn’t seem to work.

    I’m getting mad about this thing…I really don’t get the point in outputting a list when there’s only one item ??

    please help!

    Thread Starter Adz

    (@adz)

    @mpez, this may be a stupid question, but did you add singleList = true to the template?

    So people actually get mad because they can’t get free support for a free plug-in?

    Wow – grateful much?

    Did you at least make a donation before stamping your little foot?

    I added four attributes for the cft shortcode: before_list (
    <ul>), after_list (</ul>), before_value (<li>), and after_value (</li>).

    This is an example how to remove <ul><li> tags.

    [cft key=VideoID before_list='' after_list='' before_value='' after_value='']

    You can change the default attributes in the Global Settings in the setting page of the custom field template plugin.

    I hope this will work for you guys.

    Any amount of a donation is welcome:)

    @adz yes ??

    @withinreach I never said I was getting mad because I wanted free support. I just wanted to have it working: read well, dude. I’m absolutely pro-donations, but for things I actually can use. Anyway thanks for your comment, it really was an important addition to our conversation…

    @hiroaki Arigato! ?? That will do the trick: thank you very much for your interest in helping us. A donation is on the way…

    Thread Starter Adz

    (@adz)

    @hiroaki Miyashita – Thank you!! It works beautifully!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Custom Field Template] Removing <ul><li> tags’ is closed to new replies.