Sunday, July 29, 2018

Wordpress - print Custom Field with HTML content

HTML is printing as it is.


This was actually related to the view layer. Since that was not my business, I didn't care at first.
Turns out, that one has to us htmlspecialchars_decode in the templates, because the wordpress-api does htmlspecialchars on import.
The following code works fine
<? print htmlspecialchars_decode(get_custom_field('foo'));?>



Wednesday, July 4, 2018

jQuery- jQuery click event not working after adding class

Since the class is added dynamically, you need to use event delegation to register the event handler

$(document).on('click', "a.tabclick", function() {
   alert('COMES');   
});