Amamịghe echichecontent MarketingNgwaahịa Ahịa

FastBots: wulite maapụ saịtị WordPress XML omenala maka ọzụzụ AI Bot gị

Martech Zone nwere ọtụtụ puku akụkọ, ọtụtụ n'ime ha emechiela. Arụla m ọrụ na saịtị ahụ ruo ọtụtụ afọ iji wepụ ma ọ bụ melite ọtụtụ narị isiokwu, mana m ka nwere ọtụtụ ndị ọzọ. N'otu oge ahụ, ọ ga-amasị m iji ọdịnaya m zụrụ bot asụsụ okike, mana ihe ikpeazụ m chọrọ ime bụ ịzụ ya na akụkọ ochie.

FastBots bụ a Kpaa GPT-powered bot builder nke ị nwere ike ibu ụzọ zụọ site na iji saịtị saịtị gị (ma ọ bụ nhọrọ ndị ọzọ). Achọrọ m maapụ saịtị enyocha nke gụnyere akụkọ niile emezigharịrị kemgbe otu ụbọchị. Na mgbakwunye, achọrọ m itinye ibe m na acronyms (ụdị post omenala). Achọghị m itinye ibe akwụkwọ ndekọ aha maka edemede na mkpado ma ọ bụ nwee ibe ebe obibi m ebe ọ bụkwa ebe nchekwa.

Iji koodu m na-enye na njedebe nke akụkọ a; M wuru ngwa mgbakwunye WordPress nke na-emepụta omenala XML sitemap nke na-enye ume ọhụrụ oge ọ bụla m na-ebipụta post. FastBots enweghị usoro nkuzi akpaghị aka ka m na-ebipụta akụkọ ọ bụla, mana nke a bụ nnukwu mmalite maka iji ikpo okwu.

Map saịtị ahụ na-ebubata njikọ niile iji zụọ ya AI Bot na:

FastBots: zụọ bot site na saịtị saịtị gị.

A na-ebubata ibe niile ugbu a, ma ị nwere ike ịzụ bot gị na data ọdabara. Ị nwekwara ohere iwepu kpọmkwem ibe. FastBots kwekwara m ka m hazie akara ngosi AI bot na ọbụna tinye njikọ na akụkọ dị mkpa na nzaghachi m. Enwekwara arịrịọ ndu arụnyere n'ime ikpo okwu.

Ikpo okwu rụrụ ọrụ n'enweghị ntụpọ… ị nwere ike ịnye bot m nnwale ebe a:

Mwepụta Martech ZoneBot, Marty Wulite FastBots AI Bot gị

Map saịtị XML omenala

Kama ịgbakwunye ọrụ a na isiokwu m, arụrụ m omenala WordPress plugin iji wuo saịtị saịtị. Naanị tinye ndekọ na folda plugins gị, wee a PHP faịlụ na koodu na-esonụ:

<?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 bụ CMO Mepee ihe ọmụma na onye nchoputa nke Martech Zone. Douglas enyerela ọtụtụ mmalite MarTech aka nke ọma, nyere aka n'ịrụsi ọrụ ike nke ihe karịrị ijeri $ 5 na nnweta na ntinye ego nke Martech, ma na-aga n'ihu na-enyere ụlọ ọrụ aka n'imejuputa na imezi usoro ahịa na ahịa ha. Douglas bụ mgbanwe dijitalụ ama ama na mba ụwa na ọkachamara MarTech na ọkà okwu. Douglas bụkwa onye odee bipụtara nke ndu Dummie na akwụkwọ ndu azụmaahịa.

njikọ Articles

Gaa na bọtịnụ n'elu
nso

Achọpụtara ihe mgbochi

Martech Zone nwere ike ịnye gị ọdịnaya a n'efu n'ihi na anyị na-enweta saịtị anyị site na ego mgbasa ozi, njikọ ndị mmekọ, na nkwado. Ọ ga-amasị anyị ma ị ga-ewepụ ihe mgbochi mgbasa ozi gị ka ị na-elele saịtị anyị.