Programmatically publish to Apple news in my theme's functions.php
-
Is there a way I can hook into the plugin functionality to publish (or mark for publish) posts in my themes functions.php file? For example, let’s say I create a Post Category “Apple” and I want to create a function to tie into the publish_post hook that will auto publish posts in this particular category. I could use something like the following in my theme’s functions.php file:
function apple_news_auto_publish_custom_category( $ID) { $categories = get_the_category($ID); foreach($categories as $category){ if( $category['name'] == 'Apple' ){ publish_to_apple_news($ID); } } } add_action( 'publish_post', 'apple_news_auto_publish_custom_category', 20, 1 );
So in the above code sample, is there a publish_to_apple_news() type function within this plugin that I can tie into to programmatically mark posts for inclusion in my Apple News Channel?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Programmatically publish to Apple news in my theme's functions.php’ is closed to new replies.