WordPress.org

Ready to get started?Download WordPress

Forums

Need to change the format of RSS date (4 posts)

  1. bopjo1
    Member
    Posted 4 years ago #

    Hi, I am pulling in a WordPress RSS feed into another site here:

    http://assetmarketingonline.com/public_relations.php

    The default date format is: Thu, 11 Mar 2010 14:32:33 +0000

    My client wants me to get rid of the "14:32:33 +0000"

    How do I do this? My feed url is:

    http://assetmarketingonline.com/blog/wp-rss2.php

    ...but I cannot find that file anywhere!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    You need to carry this out on the recipient site when you display the feed contents. Feed timestamps are mandated by RFCs.

  3. bopjo1
    Member
    Posted 4 years ago #

    My code was generated by Dreamweaver CS4. The recieving page has this code:

    <?php
    $mm_xsl = new MM_XSLTransform();
    $mm_xsl->setXML("http://assetmarketingonline.com/blog/?feed=rss2");
    $mm_xsl->setXSL("blog_feed.xsl");
    echo $mm_xsl->Transform();
    ?>

    "blog_feed.xsl" is an XSL include file with the following code:

    <?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="http://assetmarketingonline.com/blog/?feed=rss2" -->
    <!DOCTYPE xsl:stylesheet [
    <!ENTITY nbsp " ">
    <!ENTITY copy "©">
    <!ENTITY reg "®">
    <!ENTITY trade "™">
    <!ENTITY mdash "—">
    <!ENTITY ldquo "“">
    <!ENTITY rdquo "”">
    <!ENTITY pound "£">
    <!ENTITY yen "¥">
    <!ENTITY euro "€">
    ]>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <xsl:output method="html" encoding="utf-8"/>
    <xsl:template match="/">
    <xsl:for-each select="rss/channel/item">
    <xsl:if test="position() <= 5">
    <div class="feed">
    <h3><xsl:value-of select="title"/></h3>
    <xsl:value-of select="pubDate"/>

    <p><xsl:value-of select="description" disable-output-escaping="yes"/></p>
    </div>
    </xsl:if>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    I don't know how to change the format of "pubDate"

  4. bopjo1
    Member
    Posted 4 years ago #

    I found a partial solution. If anyone else has this problem (formatting the pubDate with XSLT), change this line:

    <xsl:value-of select="pubDate"/>

    to this:

    <xsl:value-of select="substring(pubDate,1,16)"/>

    ..and it will get rid of the "14:32:33 +0000" part of the date.

Topic Closed

This topic has been closed to new replies.

About this Topic