Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
eklisiarh
tagDiv Member

Ok I solved this myself or to be precise: This is not a problem caused by Newspaper Theme but a new thing in WordPress 4.9. They decided to implement new code-checker which prevents any code with “errors” to be saved in widgets…

Anyway solution is installing Enhanced Text Widget, if someone else reads this.

  • This reply was modified 8 years by eklisiarh.
eklisiarh
tagDiv Member

In the custom HTML widget I use PHP to fill the info from the forms. Here is what I do:

I add following code to the functions.php:

add_filter('widget_text','execute_php',100);
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}

Than I use Advanced Custom Fields plugin to gather data in forms and I add these to HTML widget with this code:

<?php global $wp_query;
if(is_object($wp_query->queried_object) && $wp_query->queried_object->ID)
{
echo get_post_meta($wp_query->queried_object->ID, 'gtelefonnummer', true);
}
?>

My problem is: Since the last theme update I cannot save this code in HTML widget anymore because there are errors (which are not errors but PHP code).

So where I already saved this code everything works well but I cant save any new code because system doesn’t let me to do this. Here is screenshot:

Since widgets are theme related I presume you changed something so that I cant save this. Can this be disabled and how?

  • This reply was modified 8 years by eklisiarh.
  • This reply was modified 8 years by eklisiarh.
Viewing 2 posts - 1 through 2 (of 2 total)