Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

how to used wordpress function inside the custom function?

<?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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...