ASPDotNetStorefront WordPress module

Click here if you would like to contact us for further information.

Integrates WordPress with ASPDotNetStorefront

Features…

Download

Download available now Click the icon below to download and evaluate this module. It should run without licensing on non-production servers.

Licensing

This module costs $250 for one domain with a significant discount for each further domain required.
To license this module for production use, please visit the ASPDNSF/WordPress module licensing request form here.

Module requirements…

Installation…

ASPDotNetStorefront AppConfig values required:

‘Webopius.Wordpress.BlogKey’
Your unique key. This should match the key you configured within your WordPress web service plugin.

‘Webopius.Wordpress.BlogURL’
The full URL of your WordPress blog including http://. For example ‘http://www.myblog.com’

‘Webopius.Wordpress.License’
The unique license key emailed to you. If the license key is invalid or empty, the module will work on development servers. On live servers, an unlicensed module will work but change some post titles to contain the text ‘UNLICENSED’.

Using the module within ASPDotNetStorefront master templates

WordPress posts within your ASPDotNetStorefront site templates…

You can retrieve WordPress post information from within your ASPDotNetStorefront templates (such as homepage.master) as follows:

Add this line at the top of the template, just below the DOCTYPE line:

<%@ Register TagPrefix="webopius" TagName="getposts" Src="~/Controls/WOWPGetPosts.ascx" %>

To show post information include this line within your template:

<webopius:getposts args="numberposts=3" runat="server"/>

This example will retrieve three posts. The args parameter can accept all standard WordPress arguments (see here: http://codex.wordpress.org/Template_Tags/get_posts)

Example GetPosts arguments:

‘numberposts=2’ Limit the number of posts returned to 2
‘p=100’ Retrieve a Post with the ID 100
‘category_name=news’ Retrieve all posts in the ‘news’ Category
‘cat=273’ Find all Posts in Category ID 273
‘cat=-273’ Find all Posts except those in Category ID 273
‘tag=brixton’ Find all Posts with the tag ‘brixton’.
‘orderby=title’ Order results by Post Title. You can also use ID, author, title, name, date or rand for random order
‘order=desc’ Order results in descending order
‘tag=news%26order=desc’ Combine a series of arguments into one query. Note the use of %26 instead of &

You can control the content and which fields are displayed by editing the following file:

\controls\WOWPGetPosts.ascx

This file contains a standard ASP Repeater control which you can edit to match the HTML required by your site. Each Post is returned in the ItemTemplate block and Post fields are retrieved as follows:

<%# ((WOWP.Post)Container.DataItem).post_title %>

The example above displays the WordPress post’s title field.

To create a link to a Post, Use the Post’s ID and the standard WordPress format for linking to a post: www.yoursite.com/?p=1234 where ‘1234’ is the post id, like this:

<a href="http://www.yourblogurl.com/?p=<%# ((WOWP.Post)Container.DataItem).ID %>">View Post...</a

The following post fields are available from within this control:

ID
post_author
post_date
post_date_gmt
post_content
post_title
post_category
post_excerpt
post_status
comment_status
ping_status
post_name
to_ping
pinged
post_modified
post_modified_gmt
post_content_filtered
post_parent
guid
menu_order
post_type
post_mime_type
comment_count
filter

If you need multiple ways of displaying WordPress posts on your site, you can use the WOWPGetPosts control as an example and create new controls based upon it. Remember to create new tag prefixes for each new control you create and wish to use.

Display a WordPress post image within your ASPDotNetStorefront site templates…

To include a WordPress post’s thumbnail image within your master templates, include this line below the DOCTYPE in your master template:

<%@ Register TagPrefix="webopius2" TagName="getpostimage" Src="~/Controls/WOWPGetPostThumbnail.ascx" %>

Then include a line such as this wherever you need to display a WordPress post image:

<webopius2:getpostimage PostID=960 Size="thumbnail" runat="server"/>

In this example, a thumbnail image for Word Press post ID 960 is displayed. The size parameter can accept the standard WordPress values of ‘thumbnail’,’medium’,’large’ or ‘full’.

The WOWPGetPostThumbnail.ascx control retrieves an HTML img tag but you can edit this control to suit your requirements. You will find this code in /controls/WOWPGetPostThumbnail.ascx (and .ascx.cs)

Using the module within XML packages

To use the control within XML packages, you first need to edit your site’s web.config file. Within web.config, look for the following block…

<xsltobjects defaultExtension="">
<extensions>
...
</extensions>
</xsltobjects>

You’ll probably see an existing line within extensions related to the ASPDNSF receipt extension. Add the following line below the closing /extensions…

<add name="webopius" namespace="urn:webopius" type="WOWP.WOWPXsltExtension"></add>

So, the end result will look something like this (you may also have additional extensions installed)…

<xsltobjects defaultExtension="">
<extensions>
<clear />
<add name="receipt" namespace="urn:receipt" type="ReceiptXsltExtension, app_code"></add>
<add name="webopius" namespace="urn:webopius" type="WOWP.WOWPXsltExtension"></add>
</extensions>
</xsltobjects

Make sure that your site still runs and fix any errors before continuing.

To use the WordPress module within an XML package, include the following within the XML package’s xsl:stylesheet definition:

xmlns:webopius="urn:webopius"

Depending on your XML package, the result will look something like this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:webopius="urn:webopius" xmlns:aspdnsf="urn:aspdnsf"   exclude-result-prefixes="aspdnsf">

Again, make sure that your XML package runs correctly with this change before continuing.

Displaying a single WordPress Post within an ASPDotNetStorefront XML Package

To retrieve a WordPress post, use the GetPost() call like this:

<xsl:variable name="posts" select="webopius:GetPost(960)" />

In this example, the XSLT variable $posts contains the content of Post ID 960

The GetPost function returns an XML structure that can be parsed using standard XPath syntax. For example, to show a Post Title within an XML package:

<xsl:value-of select="$posts//Post/post_title"/>

Exactly the same Post fields are available as described previously

Displaying multiple WordPress Posts within an ASPDotNetStorefront XML Package

To retrieve one or more WordPress posts, use the GetPosts() call like this:

<xsl:variable name="posts" select="webopius:GetPosts('tag=technical%26orderby=title%26order=desc%26numberposts=3')" />

In this example, the XSLT variable $posts contains a maximum of 3 posts with the WordPress Tag ‘technical’, ordered by title in descending order. These parameters are all standard WordPress parameters allowing you to choose which posts are retrieved by customising this query.

The GetPosts function returns an XML structure that can be parsed using standard XPath syntax. For example, to show all post titles retrieved:

<xsl:for-each select="$posts//Post">
    <xsl:value-of select="post_title"/>
</xsl:for-each>

Exactly the same Post fields are available as described previously.

Linking to a WordPress post from within an ASPDotNetStorefront XML Package

Once you retrieve a series of WordPress posts using the code above, linking back to the original WordPress post can be done like this:

<xsl:for-each select="$posts//Post">
  <a>
    <xsl:attribute name="href"><xsl:value-of select="concat(aspdnsf:AppConfig('Webopius.Wordpress.BlogURL'),'?p=',ID)"/></xsl:attribute>
    <xsl:value-of select="post_title"/>
  </a>
</xsl:for-each>

Displaying WordPress Comments within an ASPDotNetStorefront XML Package

To retrieve one or more WordPress comments, use the GetComments() call like this:

<xsl:variable name="comments" select="webopius:GetComments('post_id=300')" />

In this example, the XSLT variable $comments contains comments for post ID 300.

The GetComments function returns an XML structure that can be parsed using standard XPath syntax. For example:

<xsl:for-each select="$comments//Comment">
    <xsl:value-of select="comment_content"/>
</xsl:for-each>

The following Comment fields are available:

comment_ID
comment_post_ID
comment_author
comment_author_email
comment_author_url
comment_author_IP
comment_date
comment_date_gmt
comment_content
comment_karma
comment_approved
comment_agent
comment_type
comment_parent
user_id

The arguments to GetComments are standard WordPress arguments, see here.

Only Approved Comments are returned by the GetComments call.

Displaying a WordPress Post Image Thumbnail within an ASPDotNetStorefront XML Package

To display a Post image, use the GetPostImage() call as follows:

<xsl:value-of select="webopius:GetPostImage(960,'thumbnail')" disable-output-escaping="yes" />

In this example, the ‘thumbnail’ size image for Post ID 960 is displayed.

When retrieving multiple WordPress posts using the approach describe previously, you can display the thumbnail for each post like this:

<xsl:for-each select="$posts//Post">
    <xsl:value-of select="webopius:GetPostImage(ID,'thumbnail')" disable-output-escaping="yes" />
    <xsl:value-of select="post_title"/>
</xsl:for-each>

Using WordPress as a Content Management System (CMS) for ASPDotNetStorefront

You can use WordPress pages as a replacement or addition to the existing ASPDotNetStorefront topics. In this way, WordPress effectively become a CMS for your ASPDotNetStorefront site.

To add support for this feature, add the following line to your Store’s web.config file within the routeTable/routes section:

<add name="WordPress" url="wp-{PagePath}.aspx" virtualPath="~/wp_page.aspx" checkPhysicalUrlAccess="false" />

Now, whenever you visit a page with the URL format of wp-sometext.aspx, a WordPress page that has a URL matching ‘sometext’ will be shown within your ASPDotNetStorefront site.

For example. The ASPDotNetStorefront URL: wp-terms-and-conditions.aspx will display a page containing the WordPress Page with the URL terms-and-conditions.

You can control the look of this content by editing the /controls/WOWPGetPage.ascx control.

Caching

This module has inbuilt caching to avoid making a Web Service call to WordPress every time a user views an ASPDotNetStorefront page containing WordPress elements. The default cache duration is 1 minute.

If you want to override this with your own cache duration, create a new App Config parameter called ‘Webopius.CacheDuration‘ with a numeric value for the number of minutes you would like the cached data to be stored.

Support and Troubleshooting

If you are not seeing any WordPress post information within your ASPDotNetStorefront site, try the following steps:

– Check your WordPress Web Service plugin key is configured.

– Test the web service by visiting this URL:

http://YOURWORDPRESSBLOGURL/index.php/wows_process?command=GetPosts&args=numberposts=1&key=YOURKEY

Replacing the URL and KEY values above to match your site and configuration. If the web service is working, you will see one post’s contents returned.

– Check your Store’s ‘Webopius.Wordpress.BlogKey’ value matches the value within your WordPress WebService plugin

– Check your Store’s ‘Webopius.WordPress.BlogURL’ value matches your blog’s URL (including http://).

– Look at the content of your ASPDotNetStorefront system log for messages related to the Web Service.

If you are still having trouble, our support forum is here: http://support.webopius.com, alternatively, please email support@webopius.com