Blogs

In essence, a LiveWhale blog is a collection of chronological posts, with a few special features:

Custom Fields

By default, all blog posts have:

  • title field
  • body field (WYSIWYG, can include text, images, embedded media)
  • image
  • date

You can add custom fields to your blog (e.g., current mood, current city, video URL, phone number, or any other) and they will be available in each blog post. You can set custom fields as required, if you like.

Comments

You can enable Disqus comments enabled site-wide, or use a custom Disqus setup unique to your blog (more below).

Contributors and Moderators

You have the option to hand-pick contributors (allowed to post) and moderators (must approve any post) from any LiveWhale group. If you don’t set contributors, any editor from your group will be able to add/edit posts in your blog. If you don’t set any moderators, than editors/contributors can publish their own posts.

Displaying Your Blog

Once your blog is created and has a few posts, you’ll use a widget to display it on any page you like. Go to Widgets > Add a new widget and select “Blogs“ as the widget type. Under the basic options, choose your blog’s name in the “Only display posts from blog(s):” field.

For the widget format, you can choose any fields you like to display. The following is a basic starter format, which shows the date, title, image, and a summary for each post, along with a link to the full entry:

<div class="lw_blogs_title">{date}: {title}</div>
<span class="lw_blogs_image">{image}</span>
<div class="lw_blogs_summary">{summary}</div>
<a href="{href}">Read more...</a>

Or, you can show the full text of each blog post in the widget: 

<div class="lw_blogs_title">{date}: {title}</div>
<span class="lw_blogs_image">{image}</span>
<div class="lw_blogs_summary">{post}</div>

Save your widget and drop it into any page: that’s it! Your blog is now publicly visible.

Creating a Blog Post Details Template

Just like with a news story, LiveWhale needs a details template to display individual blog posts. By default, LiveWhale will look for /_ingredients/templates/details/blogs.php for this file, though you can set your own file path in your site-wide config file.

Near the top of your blogs.php template, make sure to include <widget type="blogs_details" priority="high"/>. You can use the following XPHP variables to setup your details template. (Note: 90% of the variables for blogs will match what you already have in your profiles.php template.)

Variable Description
<xphp var="details_title"/> Displays the title of your blog post.
<xphp var="details_post"/> Displays the contents of your blog post.
<xphp var="details_date"/> Displays the date of your blog post.
<xphp var="details_image"/> Displays the image attached to your blog post.
<xphp var="details_body"/> Displays all custom fields assigned to “body” in your blog setup.
<xphp var="details_sidebar"/> Displays all custom fields assigned to “sidebar” in your blog setup.
<xphp var="details_blog_url"/> The URL of the homepage indicated in your blog’s settings. (LiveWhale 1.7+)
<xphp var="blogs_###"/> Displays the contents of a custom field (i.e., blogs_2).

Tip: Since LiveWhale uses the same blogs.php details template for all your blogs, it’s a good idea to include some XPHP conditional logic when displaying custom fields, since different blogs will have different custom fields. 

<xphp content="true">
<if var="blogs_10"/>
    <content>
        <!– there is content in the blogs_10 custom field –>
        My custom field: <xphp var="blogs_10"/>
    </content>
</xphp>

Enabling Disqus comments for blogs

Disqus is a feature-rich commenting and community platform, and you can enable Disqus comments site-wide and use them on any details templates—events, news, etc. Blogs are no different, and if you already have Disqus setup, no further steps are needed.

However, you might want one of your blogs to use a different Disqus account than your main site. Or, you might only want Disqus comments on a blog, and not on any other pages.

To enabling Disqus commenting on a per-blog basis, simply:

  1. Create an account at Disqus.com
  2. Copy the site name portion of the unique Disqus URL
  3. Enter the site name under the “Comment Settings” in the Add/Edit Blog Details page.
  4. To display the Disqus comments, make sure <xphp var="disqus_comments" /> is in your blog post details template.

On a blog, LiveWhale will first check if this setting is in use; if not, it will fallback to the site-wide Disqus shortname, if one has been set.

Where LiveWhale sees that disqus_comments XPHP variable, it will load in the Disqus script and comment container. If there is already an element with id="disqus_thread" on your template or page, it won’t run, as each page can only have one Disqus thread.

To disable comments on a blog, you can create a custom details template and exclude <xphp var="disqus_comments" />.

On this page