2017-09-27 29 views
0

我試圖從數據庫中提取名稱和電子郵件並顯示在我的網站的前端。我嘗試了很多腳本,並在火烈鳥論壇上看過。但無法找到解決方案。使用meta_key從Flamingo插件的數據庫中提取電子郵件和名稱

所有數據保存在wp_postmeta之一。我如何區分flemingo postmeta,因爲有多個postmeta?我該如何拉入flemingo _field_fullname_from_email? 這裏是一個數據庫轉儲

INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES 
(5874, 1438, '_field_fullname', 'Jason'), 
(5875, 1438, '_field_phone', '04112343'), 
(5876, 1438, '_field_email', '[email protected]'), 

由於堆提前。

https://wordpress.org/plugins/flamingo/

回答

0

我做了一個控制檯工具,顯示這可能有助於最新的電子郵件

//Add custom dashboard widget 

function my_custom_dashboard_widgets() { 
wp_add_dashboard_widget('my_show_latest_emails', 'Latest Emails', 
'my_show_latest_emails'); 
} 
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets'); 


//function to get emails 
function my_show_latest_emails() { 

echo '<div id="activity-widget">'; 

$args = array(
    'numberposts' => 10, 
    'offset' => 0, 
    'category' => 0, 
    'orderby' => 'post_date', 
    'order' => 'DESC', 
    'include' => '', 
    'exclude' => '', 
    'meta_key' => '', 
    'meta_value' =>'', 
    'post_type' => 'flamingo_inbound', 
    'post_status' => 'publish', 
    'suppress_filters' => true 
); 

$recent_emails = wp_get_recent_posts($args, ARRAY_A); 

if($recent_emails) 
{ 
    echo '<table><thead><th>Date</th><th>Email</th></thead><tbody>'; 
    foreach($recent_emails as $email){ 
     echo '<tr>'; 
     echo '<td>' . $email->post_date . '</td>'; 
     echo '<td>' . $email->post_title . '</td>'; 
     echo '</tr>'; 

    } 
    echo '</tbody></table>'; 
} 

if (!$recent_emails) { 
    echo '<div class="no-activity">'; 
    echo '<p class="smiley"></p>'; 
    echo '<p>' . __('No activity yet!') . '</p>'; 
    echo '</div>'; 
} 

echo '</div>'; 
} 
相關問題