how to used wordpress function inside the custom function?

南楼画角 提交于 2019-12-26 12:14:43

问题


<?php function tms_footerWidget(){
    global $wpdb;
    $results = $wpdb->get_results( "SELECT `tms_footerColumns` FROM `wp_tms`");
        foreach ($results as $row) {
           $tms_footerWidget = $row->tms_footerColumns;
            }
      $colsOne="<div class=\"col-xs-12 col-md-12 col-sm-12\"><div class=\"thumbnail\"><?php dynamic_sidebar('tms_footer2'); ?></div>";
    return $colsOne;
  }
?>

and after i have used this function in my html code and i run my php page at that that time these function could not working ..so i see in inspect elements following type of the error plz..tell me answer of this problem...


回答1:


You haveto pass wordpress hook as you are using custom function. (i.e., add_action('wp_head', 'tms_footerWidget'))



来源:https://stackoverflow.com/questions/31509625/how-to-used-wordpress-function-inside-the-custom-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!