I-FastBots: Yakha Imephu Yesayithi Ye-WordPress XML Yangokwezifiso Ukuze Uqeqeshe I-AI Yakho Bot
Martech Zone inezinkulungwane zezihloko, eziningi zazo eziphelelwe yisikhathi. Ngisebenze kusayithi iminyaka eminingana ukuze ngisuse noma ngibuyekeze amakhulukhulu ezindatshana, kodwa ngisenazo eziningi. Ngesikhathi esifanayo, ngingathanda ukuqeqesha i-bot yolimi lwemvelo ngokuqukethwe kwami, kodwa into yokugcina engifuna ukuyenza ukuyiqeqesha kuma-athikili aphelelwe yisikhathi.
I-FastBots is a I-ChatGPT-Umakhi we-bot onamandla ongawuqeqesha ekuqaleni usebenzisa imephu yakho yesayithi (noma ezinye izinketho). Bengidinga imephu yesayithi ehlungiwe ehlanganisa zonke izindatshana ezilungiswe kusukela ngedethi ethile. Ukwengeza, bengifuna ukufaka amakhasi ami kanye ama-akhronimi (uhlobo lokuthunyelwe kwangokwezifiso). Bengingafuni ukufaka amakhasi engobo yomlando wezigaba nomaka noma ukuba nekhasi lami lasekhaya njengoba liyingobo yomlando.
Ukusebenzisa ikhodi engiyinikezayo ekupheleni kwalesi sihloko; Ngakhe i-plugin ye-WordPress yangokwezifiso eyakha inkambiso XML imephu yesayithi evuselela ngamandla isikhathi ngasinye lapho ngishicilela okuthunyelwe. I-FastBots ayinayo indlela yokuqeqesha kabusha ezenzakalelayo njengoba ngishicilela isihloko ngasinye, kodwa lesi yisiqalo esihle sokusebenzisa inkundla.
Imephu yesayithi ingenisa ngaphandle zonke izixhumanisi zokuqeqesha AI I-Bot ivuliwe:
Wonke amakhasi manje angenisiwe, futhi ungakwazi ukuqeqesha i-bot yakho ngedatha esebenzayo. Uphinde ube nethuba lokususa amakhasi athile. I-FastBots iphinde yangivumela ukuthi ngenze ngokwezifiso ukumaketha kwe-AI bot yami futhi ngifake nesixhumanisi esihlokweni esifanele empendulweni yami. Kukhona nesicelo sokuhola esakhelwe endaweni yesikhulumi.
Inkundla isebenze ngokungenasici... unganikeza i-bot yami ukuhlola lapha:
Qalisa Martech ZoneU-Bot, uMarty Yakha i-FastBots Yakho ye-AI Bot
Imephu yesayithi ye-XML yangokwezifiso
Kunokuba ngengeze lokhu kusebenza kutimu yami, ngakhe isiko WordPress i-plugin ukwakha imephu yesayithi. Vele wengeze uhla lwemibhalo kufolda yakho yama-plugin, bese u-a PHP ifayela elinekhodi elandelayo:
<?php
/*
Plugin Name: Bot Sitemap
Description: Dynamically generates an XML sitemap including posts modified since a specific date and updates it when a new article is added.
Version: 1.0
Author: Your Name
*/
// Define the date since when to include modified posts (format: Y-m-d)
$mtz_modified_since_date = '2020-01-01';
// Register the function to update the sitemap when a post is published
add_action('publish_post', 'mtz_update_sitemap_on_publish');
// Function to update the sitemap
function mtz_update_sitemap_on_publish($post_id) {
// Check if the post is not an auto-draft
if (get_post_status($post_id) != 'auto-draft') {
mtz_build_dynamic_sitemap();
}
}
// Main function to build the sitemap
function build_bot_sitemap() {
global $mtz_modified_since_date;
$args = array(
'post_type' => 'post',
'date_query' => array(
'column' => 'post_modified',
'after' => $mtz_modified_since_date
),
'posts_per_page' => -1 // Retrieve all matching posts
);
$postsForSitemap = get_posts($args);
// Fetch all 'acronym' custom post type posts
$acronymPosts = get_posts(array(
'post_type' => 'acronym',
'posts_per_page' => -1,
));
// Fetch all pages except the home page
$pagesForSitemap = get_pages();
$home_page_id = get_option('page_on_front');
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>';
$sitemap .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach($postsForSitemap as $post) {
setup_postdata($post);
if ($post->ID != $home_page_id) {
$sitemap .= '<url>'.
'<loc>'. get_permalink($post) .'</loc>'.
'<lastmod>'. get_the_modified_date('c', $post) .'</lastmod>'.
'<changefreq>weekly</changefreq>'.
'</url>';
}
}
foreach($acronymPosts as $post) {
setup_postdata($post);
if ($post->ID != $home_page_id) {
$sitemap .= '<url>'.
'<loc>'. get_permalink($post) .'</loc>'.
'<lastmod>'. get_the_modified_date('c', $post) .'</lastmod>'.
'<changefreq>weekly</changefreq>'.
'</url>';
}
}
foreach($pagesForSitemap as $page) {
setup_postdata($page);
if ($page->ID != $home_page_id) {
$sitemap .= '<url>'.
'<loc>'. get_permalink($page) .'</loc>'.
'<lastmod>'. get_the_modified_date('c', $page) .'</lastmod>'.
'<changefreq>monthly</changefreq>'.
'</url>';
}
}
wp_reset_postdata();
$sitemap .= '</urlset>';
file_put_contents(get_home_path().'bot-sitemap.xml', $sitemap);
}
// Activate the initial sitemap build on plugin activation
register_activation_hook(__FILE__, 'build_bot_sitemap');