PS: updated for SunBlogNuke v4.4.

Finally our development team implemented the custom fields feature for Ultimate DNN Blog Module – SunBlogNuke in the upcoming version 4.2, which will be available soon. The use of custom fields will be one of the keys to SunBlogNuke’s flexibility and endless possibilities.

Essentially, all a Custom Field does is allow you to add extra pieces of data to individual DNN Blog posts that otherwise aren’t there by default. We hope that it will change the way people look at SunBlogNuke and rise in popularity of SunBlogNuke, too.

The first thing you need to know is where to input custom fields. On “Edit Post” in the SunBlogNuke Dashboard, there is section at the bottom of the page that lets you input as many custom fields as you want. A custom field consists of two different concepts — "Key" and "Value". The Key is the name of the custom field and the Value is simply the value you want to give to that name. It doesn’t get much simpler than that.

In this tutorial, I’ll show you how you can easily add thumbnails to individual posts in SunBlogNuke. These images can be shown on the Content Slider Widget , archives, blog home pages, etc – but appear outside of the content, giving you full control of their placement and style. Okay, let’s go through those simple steps below:

1) Simply start making a New Post and scroll down “Custom Fields” section.

2) Just fill in the Key with “thumbnail”. For the Value, post the full URL of the thumbnail you would like to use. Click “Add Custom Field”, and it will apply to that post.  (Optional: you can also create a key named "Thumbnail Class”. Give it a Value of “thumbnail-class” or anything that you can use to style in your style sheet (style.css). Or you can create alt text for your image with creating a Key named "thumbnail-alt” with a Value of “Describe your image.” If you don’t do this, the alt text will default to the post title.) Like that screenshot below:

Custom Fields Section

Note that if  you have a key called Thumbnail, you’ll never have to create that key again.  It’s stored so you may select it from the dropdown box for now on.

3) Add the following code in theme view file “BasicView.ascx” in order to show our newly created thumbnails in recent post list: (Please get more details about theme mechanism from this tutorial - Develop Your Customized Theme for DNN Blog Module)

    Dim thumbnailUrl As String = GetCustomField("thumbnail")
    Dim thumbnalClass As String = GetCustomField("thumbnail-class")
    Dim thumbnailAlt As String = GetCustomField("thumbnail-alt")
    If Not String.IsNullOrEmpty(thumbnailUrl) Then
        <img src="<%=thumbnailUrl%>" alt="<%=thumbnailAlt%>" class="<%=thumbnalClass%>"/>
    End If

4) Or use it in Content Slider Widget like that:

<img src="[customfield:thumbnail]" class="[customfield:thumbnail-class]" alt="[customfield:thumbnail-alt]"/>
<img src="YOUR_DEFAULT_THUMBNAIL" class="[customfield:thumbnail-class]" alt="[customfield:thumbnail-alt]"/>

The block code section means that with it you can check out whether the custom field [thumbnail] is null or empty, if not it will append the code snippet as follows:

<img src="[customfield:thumbnail]" class="[customfield:thumbnail-class]" alt="[customfield:thumbnail-alt]"/>

otherwise it will append the code snippet after the token {else} as follow: (Replace the ‘YOUR_DEFAULT_THUMBNAIL’ with your real thumbnail url)

<img src="YOUR_DEFAULT_THUMBNAIL" class="[customfield:thumbnail-class]" alt="[customfield:thumbnail-alt]"/>

Well, that is all but I would like to say that the tutorial is only a start for you and the truth is that you can do pretty much anything you want with custom fields. Your imagination is your limit.

As usual, please let me know your thoughts with leaving your comment below and make sure to enter your suggestions for improving our product at support forum.