2015-04-14 46 views
0

我做了一個完全響應的wordpress網站,然後我開發了一個iOS應用程序,它使用xmlParser從我的wordpress獲取新聞提要 我甚至包括推送通知給我的應用程序,尋找的是:? 在哪裏放置一個PHP代碼,每次我發佈新帖子時都會被執行,這樣我就可以將推送通知發送給我的應用用戶 我在尋找「wordpress」文件,但我找不到合適的地方抓住帖子標題,鏈接和內容,所以我可以發送他們在每個Wordpress的新帖子後執行php代碼

請幫助! 感謝名單

+4

https://codex.wordpress.org/Plugin_API/Action_Reference/save_post – Reigel

回答

0

在functions.php中添加此:

add_action('save_post', 'your_function'); 

function your_function($post_id, $post, $update) { 
    // Magic. 
    // (Check your post type because this will be fired on page creation too.) 
} 

這將導致your_function()被稱爲每次插入一個新的職位時。

食品:https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

相關問題