PHP Code Widget eklentisini kullanıyorum widgete php kodunu ekledikten sonra aşağıdaki hatayı alıyorum Kubrick Theme yi kullanıyorum yardımcı olursanız sevinirim.
Fatal error: Call to a member function get_var() on a non-object in /home/wwgame/public_html/wp-content/plugins/php-code-widget/execphp.php(44) : eval()'d code on line 2
eklediğim kod:
<?php
$uyeler = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
echo 'Sitemizdeki toplam üye sayısı' . $uyeler . ' ';
?>https://www.r10.net/wordpress/974414-...listirmak.html
Benim istediğim sadece widgette php kodunu çalıştırabilmek.functions.php aşağıdaki kodu ekle dediler ekledim ama değişen birşey yok yazdığım kodun aynıı sidebarda görünüyor.
// Run php in text widget
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;
}