Algorithmia AI Generated Summary"; //bail out if we've been here before! if(strpos($content, $summary_title) !== false) return $content; //setup our Algorithmia client $apikey = get_option('algo_options')['algo_field_api']; $client = Algorithmia::client($apikey); //send our post content to Algorithmia's AI for processing! $algo = $client->algo("nlp/Summarizer/0.1.8"); $result = $algo->pipe($in_content)->result; //concatenate our final result $content = $summary_title. $result. "
". $in_content; } return $content; } //admin section for this algorithm that appears on the settings page function algo_upload_post_summarizer_settings_init() { // register a new section in the "algo" page add_settings_section( 'algo_section_psum', //id 'Feature: Post Summarizer', //title 'algo_section_psum_cb', //callback 'algo' //page (menu-slug) ); add_settings_field( 'algo_field_psum_enabled', //id 'Enable this feature', //title 'algo_field_checkbox_cb', //callback for text fields 'algo', //page (menu-slug) 'algo_section_psum', //section [ //args 'label_for' => 'algo_field_psum_enabled', 'class' => 'algo_row', 'algo_custom_data' => 'custom', 'default' => false ] ); } //callback for the section header created above. function algo_section_psum_cb( $args ) { ?>