Can you clarify what you mean by “admin doesn’t recognize the next line”? In the manager, I can’t duplicate that behavior… I press enter, and the line advances. In your themes, newlines will be converted to br tags if you use the “do_shortcode” output filter — that incorporates the wpautop() function.
Other than that, it is probably a bug in WP’s implementation of TinyMCE. The WYSIWYG fields have been an enormous pain (check the bug-tracker) largely due to WP’s wonky integration with TinyMCE.
Thread Starter
jumust
(@jumust)
Sorry if I was not clear.
When I press enter and the line advances, newlines is not converted to br tags (if I switch to html in the editor I can’t see br tags)
I’m using wrapper because as for your suggestion in my other thread I don’t want to show the custom field if it’s empty
<?php print_custom_field('contatti:wrapper'
, '<div class="one_half" style="margin-bottom: 15px;"><span class="tag_green">Contatti</span><div style="margin-top:10px;">[+content+]</div></div>'
);
?>
What should I do?
Yeah, that’s tough — the WYSIWYG fields rely on WP’s implementation of TinyMCE, so the behavior inside the field is what it is, unfortunately, but it should match up to how WP handles its built-in WYSIWYG field (the main content block).
However, in your theme, you can simply add the “do_shortcode” filter to the chain:
<?php
print_custom_field('contatti:do_shortcode:wrapper'
, false
, '<div class="one_half" style="margin-bottom: 15px;">
<span class="tag_green">Contatti</span>
<div style="margin-top:10px;">[+content+]</div>
</div>'
);
?>
Or perhaps easier to read:
<?php
$content = get_custom_field('contatti:do_shortcode');
print CCTM::filter($content, 'wrapper'
, '<div class="one_half" style="margin-bottom: 15px;">
<span class="tag_green">Contatti</span>
<div style="margin-top:10px;">[+content+]</div>
</div>'
);
?>
Or just use WP’s wpautop() function to operate on the wrapped field value:
<?php
print wpautop( get_custom_field('contatti:wrapper'
, '<div class="one_half" style="margin-bottom: 15px;">
<span class="tag_green">Contatti</span>
<div style="margin-top:10px;">[+content+]</div>
</div>'
)
);
?>
Something like that should take care of it.
Thread Starter
jumust
(@jumust)
THANKS!
The third worked like a charm!!! your plugin is awesome!
Great! Glad you got it working. If your find the plugin useful, donations are always appreciated 😉