Atifisyèl entèlijansMaketing KontniZouti Maketing

FastBots: Konstwi yon Sitemap Custom WordPress XML Pou Fòmasyon AI Bot ou

Martech Zone gen dè milye de atik, ak anpil nan yo demode. Mwen te travay sou sit la pandan plizyè ane pou retire oswa mete ajou dè santèn de atik, men mwen toujou gen anpil plis. An menm tan an, mwen ta renmen fòme yon bot lang natirèl ak kontni mwen an, men dènye bagay mwen vle fè se fòme li sou atik demode.

FastBots se yon Chat GPT-powered bot builder ke ou ka okòmansman fòme lè l sèvi avèk sitemap ou a (oswa lòt opsyon). Mwen te bezwen yon sitemap filtre ki enkli tout atik modifye depi yon dat espesifik. Anplis de sa, mwen te vle mete paj mwen yo ak akwonim (yon kalite pòs koutim). Mwen pa t 'vle mete paj achiv pou kategori ak tag oswa gen paj lakay mwen paske li se yon achiv tou.

Sèvi ak kòd mwen bay nan fen atik sa a; Mwen te konstwi yon plugin personnalisé WordPress ki kreye yon personnalisé XML Sitemap ki rafrechi dinamik chak fwa mwen pibliye yon pòs. FastBots pa gen yon metòd retraman otomatik jan mwen pibliye chak atik, men sa a se yon bon pwen depa pou itilize platfòm la.

Sitemap la enpòte tout lyen yo pou antrene a AI Bot sou:

FastBots: Antrene yon bot soti nan sitemap sit ou a.

Tout paj yo kounye a enpòte, epi ou ka fòme bot ou a sou done ki aplikab yo. Ou gen tou opòtinite pou retire paj espesifik. FastBots pèmèt mwen tou personnaliser mak AI bot mwen an e menm enkli yon lyen ki mennen nan yon atik ki enpòtan nan repons mwen an. Genyen tou yon demann plon ki te bati nan platfòm la.

Platfòm nan te travay parfètman... ou ka bay bot mwen an yon tès kondwi isit la:

Lanse Martech ZoneBot la, Marty Bati FastBots AI Bot ou a

Custom XML Sitemap

Olye ke ajoute fonksyonalite sa a nan tèm mwen an, mwen bati yon koutim WordPress plugin pou konstwi yon Sitemap. Jis ajoute yon anyè nan katab grefon ou a, Lè sa a, yon PHP dosye ak kòd sa a:

<?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');

Douglas Karr

Douglas Karr se CMO nan OpenINSIGHTS ak fondatè a nan Martech Zone. Douglas te ede plizyè douzèn demaraj MarTech ki gen siksè, li te ede nan dilijans plis pase $5 milya nan akizisyon ak envestisman Martech, epi li kontinye ede konpayi yo nan mete ann aplikasyon ak otomatize estrateji lavant ak maketing yo. Douglas se yon transfòmasyon dijital entènasyonalman rekonèt ak ekspè MarTech ak oratè. Douglas se tou yon otè pibliye nan yon gid Dummie a ak yon liv lidèchip biznis.

Atik ki gen rapò

Retounen nan bouton tèt
Fèmen

Adblock Detekte

Martech Zone se kapab ba ou kontni sa a gratis paske nou monetize sit nou an atravè revni anons, lyen afilye, ak parennaj. Nou ta apresye si ou ta retire bloke anons ou a pandan w ap gade sit nou an.