• Hello All,

    I am using Custom modules to build the XML sitemap. But the problem is my last modified date is always showing as wrong.
    For example,
    2014-03-31 20:10:12
    2014-03-30 20:10:12
    2014-03-29 20:10:12
    2014-03-28 20:10:12
    .
    .
    .

    Like so its getting decremented one by one.

    So I need to set all the last modified date as current date. So Please support me on this issue.

    Also, whenver I am passing the current date and time to the plugin using custom modules its not working. its showing the above results. Please help me. Its bit urgent.

    Thanks in advance.

    https://wordpress.org/plugins/bwp-google-xml-sitemaps/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Khang Minh

    (@oddoneout)

    Can you post your custom module here so I can take a look?

    Thread Starter Harish Tharakanchalla Chinju

    (@htc1014)

    Hi this is my code

    ` class BWP_GXS_MODULE_SCHOOL_SITEMAP_1 extends BWP_GXS_MODULE {
    function __construct() {
    $this->set_current_time();
    $this->build_data();
    }
    function build_data() {
    global $wpdb, $bwp_gxs, $wp_schoolfinderurl;

    /* QUERY TO GET ALBUMS – THE TABLE IS IN THE SAME WORDPRESS DB, SO
    YOU CAN USE HERE THE wpdb WORDPRESS CLASS TO INTERACT WITH THE DATABASE */

    $sitemap_urls = readUrlFromFile();

    /* IF THE TABLE IS IN ANOTHER DATABASE,
    YOU CAN USE THE PHP MYSQL FUNCTIONS */
    if ( !isset( $sitemap_urls) || 0 == sizeof( $sitemap_urls ))
    return false;
    $data = array();
    for ( $i = 1; $i <= 5000; $i++ ) {
    $url = $sitemap_urls[$i];
    $data = $this->init_data( $data );
    // REPLACE THIS WITH CORRECT URL TO YOUR ALBUMS
    // ESPECIALLY YOUR WEBSITE URL
    $data[“location”] = $url;
    $data[“lastmod”] = $this->format_lastmod(strtotime(current_time(“mysql”)));
    $this->data[] = $data;
    }
    return true;
    }
    }

    Thread Starter Harish Tharakanchalla Chinju

    (@htc1014)

    Or else please let me know how to remove the Last Modified Date from the sitemap development. So it is fine for me now.

    Thread Starter Harish Tharakanchalla Chinju

    (@htc1014)

    I have fixed the Last modified date issue with Sitemap XML using custom xsl stylesheet.

    I removed it using custom xsl, but is it possible to build the current date.?

    Plugin Author Khang Minh

    (@oddoneout)

    Hmm try this (replacing the corresponding block):

    $now = current_time('timestamp');
    $data = array();
    for ( $i = 1; $i <= 5000; $i++ ) {
    $url = $sitemap_urls[$i];
    $data = $this->init_data( $data );
    // REPLACE THIS WITH CORRECT URL TO YOUR ALBUMS
    // ESPECIALLY YOUR WEBSITE URL
    $data["location"] = $url;
    $data["lastmod"] = $this->format_lastmod($now);
    $this->data[] = $data;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Last modified date need to current date’ is closed to new replies.