'; private $client = null; public $notices = []; public $limit = 50; private $plan_limit_aiautotool ; public $name_plan ; public $config = array(); public $notice ; public function __construct() { $this->name_plan = __('Webstories','ai-auto-tool'); $this->setting = get_option($this->namesetting,array()); if(!isset($this->setting['logo'])){ $this->setting['logo'] = 'https://aiautotool.com/96logo.png'; } $this->active = get_option($this->active_option_name, false); if ($this->active=='true') { $this->init(); } add_action('wp_ajax_update_active_option_canonical_'.$this->active_option_name, array($this, 'update_active_option_callback')); add_action('wp_ajax_nopriv_update_active_option_canonical_'.$this->active_option_name, array($this, 'update_active_option_callback')); } public function update_active_option_callback() { check_ajax_referer('aiautotool_nonce', 'security'); if (isset($_POST['active'])) { $active = sanitize_text_field($_POST['active']); update_option($this->active_option_name, $active,null, 'no'); print_r($active); } wp_die(); } public function init(){ // Hook into WordPress to register the custom URL add_action('init', array($this, 'add_custom_rewrite_rule')); // Hook into WordPress to add custom rewrite rules add_filter('query_vars', array($this, 'custom_rewrite_query_vars')); // Hook into WordPress to handle the custom template add_filter('template_include', array($this, 'custom_rewrite_rule_template')); register_setting('aiautotool_webstories_config_group', $this->namesetting); // add_action('do_feed_aiwebstories_feed', array($this, 'custom_feed_template')); } public function render_setting() { ?> active=='true') { echo ''; } } public function render_feature(){ $autoToolBox = new AutoToolBox($this->icon." Active Webstorie", __('If active it, webstories has domain.com/aiwebstories/','ai-auto-tool'), "https://aiautotool.com", $this->active_option_name, $this->active,plugins_url('../images/logo.svg', __FILE__)); echo ($autoToolBox->generateHTML()); ?> Web Stories

' . esc_html(bloginfo('title')) . ''; ?>

Web Stories

'post', 'post_status' => 'publish', 'posts_per_page' => 30, 'orderby' => 'date', 'order' => 'DESC', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS', ), ), 'paged' => $paged, ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $post_title = get_the_title(); $post_name = get_post_field('post_name', $post->ID); $post_thumbnail_url = get_the_post_thumbnail_url($post, 'thumbnail'); ?>
'; echo ''; wp_reset_postdata(); ?>
AI auto tool - Stories
Web Stories by aiautotool.com
aiautotool_rewriter_flushed) ) { flush_rewrite_rules(false); update_option($this->aiautotool_rewriter_flushed, 1); } } public function custom_rewrite_query_vars($query_vars) { $query_vars[] = 'custom_aiwebstories'; $query_vars[] = 'postname'; $query_vars[] = 'aiwebstories_feed'; // print_r($query_vars); return $query_vars; } public function custom_rewrite_rule_template($template) { if (get_query_var('custom_aiwebstories')) { if(get_query_var('aiwebstories_feed')){ $this->custom_feed_template(); exit; }else{ $postname = get_query_var('postname'); if ($postname) { $this->display_theme_for_postname($postname); exit; }else{ $this->custom_rewrite_rule_handler(); exit; } } } return $template; } public function display_theme_for_postname($postname) { $page = get_page_by_path($postname,OBJECT,'post'); if ($page) { // Lấy thông tin chi tiết của bài viết $post_id = $page->ID; $post_title = get_the_title($post_id); $post_url = get_permalink($post_id); // $post_content = get_post_field('post_content', $post_id); $post_content = get_the_content(null, false, $post_id); $url_thumb = get_the_post_thumbnail_url($post_id, 'thumbnail'); $post_date = get_post_time('Y-m-d\TH:i:sP', true, $post_id); $post_author = get_the_author_meta('display_name', get_post_field('post_author', $post_id)); $image_urls = array(); $paragraphs = array(); $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($post_content); libxml_use_internal_errors(false); $images = $dom->getElementsByTagName('img'); $image_urls = array(); foreach ($images as $image) { $src = $image->getAttribute('src'); if ($src) { $image_urls[] = $src; } } if ($url_thumb=='') { $url_thumb = $image_urls[0]; } $contenttext = strip_tags($post_content); $paragraphs = explode('.',$contenttext); $article_body_content = implode("\n", $paragraphs); $article_body_unicode = json_encode($article_body_content, JSON_UNESCAPED_UNICODE); ?> <?php echo esc_html($post_title);?> '; echo json_encode(array( '@context' => 'http://schema.org', '@type' => 'Article', 'mainEntityOfPage' => array( '@type' => 'WebPage', 'url' => esc_url($post_url), 'name' => esc_html($post_title), ), 'headline' => esc_html($post_title), 'datePublished' => $post_date, 'dateModified' => $post_date, 'author' => array( '@type' => 'Person', 'name' => esc_html($post_author), 'url' => get_author_posts_url(get_the_author_meta('ID', $post_id)), ), 'publisher' => array( '@type' => 'Organization', 'name' => get_bloginfo('name'), ), 'description' => '', 'image' => array( '@type' => 'ImageObject', 'url' => esc_url($url_thumb), ), 'articleBody' => strip_tags($article_body_unicode), ), JSON_UNESCAPED_UNICODE); echo ''; ?>

$paragraph) { if($paragraph!=''){ $img = $url_thumb; if(isset($image_urls[$index])){ $img = $image_urls[$index]; } ?> Read more Visit our site and see all other available articles! Read more setting['analytic'])&&$this->setting['analytic']!=''){ ?> Post not found!

'; } } public function custom_feed_template() { header('Content-Type: application/rss+xml; charset=' . get_option('blog_charset'), true); $more = 1; echo ''; ?> <?php bloginfo_rss('name'); wp_title_rss(); ?> en ID); $urllink = esc_url($this->gen_url_storiepost($post_name)); $description = get_the_excerpt(); $content = get_the_content(); ?> Stories <?php the_title_rss(); ?> ]]> ]]> 0