2013-12-17 50 views
0

在我的編輯器中查看文件是一個函數,函數內部是單引號中的字符串。php wordpress函數,在單引號中的字符串解釋

我有這個WordPress的功能,像這樣:

<div class="site-info"> 
       <?php do_action('focus_credits'); ?> 
      </div><!-- .site-info --> 

當我在Chrome檢查元素是這樣的:

<div class="site-info"> 
       Theme By yada yada yada and a link to their website here   </div> 

我的問題是如何將文字字符串「焦點學分」返回主題的名稱以及到其網站的href鏈接。

我已經發現了do_action功能在plugin.php

function do_action($tag, $arg = '') { 
    global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; 

    if (! isset($wp_actions[$tag])) 
     $wp_actions[$tag] = 1; 
    else 
     ++$wp_actions[$tag]; 

    // Do 'all' actions first 
    if (isset($wp_filter['all'])) { 
     $wp_current_filter[] = $tag; 
     $all_args = func_get_args(); 
     _wp_call_all_hook($all_args); 
    } 

    if (!isset($wp_filter[$tag])) { 
     if (isset($wp_filter['all'])) 
      array_pop($wp_current_filter); 
     return; 
    } 

    if (!isset($wp_filter['all'])) 
     $wp_current_filter[] = $tag; 

    $args = array(); 
    if (is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0])) // array(&$this) 
     $args[] =& $arg[0]; 
    else 
     $args[] = $arg; 
    for ($a = 2; $a < func_num_args(); $a++) 
     $args[] = func_get_arg($a); 

    // Sort 
    if (!isset($merged_filters[ $tag ])) { 
     ksort($wp_filter[$tag]); 
     $merged_filters[ $tag ] = true; 
    } 

    reset($wp_filter[ $tag ]); 

    do { 
     foreach ((array) current($wp_filter[$tag]) as $the_) 
      if (!is_null($the_['function'])) 
       call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args'])); 

    } while (next($wp_filter[$tag]) !== false); 

    array_pop($wp_current_filter); 
} 

所以他的 'focus_credits' 調用從DB一些文本?

我通過一些表看了,但找不到任何有關..

任何幫助在哪裏看將是巨大的。提前致謝。

回答

3

do_action()在您的模板中插入一個動作鉤子。如果你挖通你的主題文件,可能functions.php,你會發現,掛到這個動作鉤子函數:

add_action('focus_credits', 'focus_credits'); 
function focus_credits(){ 
    echo 'Theme By yada yada yada and a link to their website here';  
} 

更多信息上do_action()http://codex.wordpress.org/Function_Reference/do_action

+0

發現了它,你點的,謝謝。 –

相關問題