Tagged: wordpress

Put Code Snippets in a WordPress Blog

I’ve installed WP-Syntax, a great plugin for WordPress that lets you add code snippets to your blog posts without losing all the formatting.

You can use all manner of languages and even include line numbers if you want. Here’s a snippet from one of my math worksheet makers written in Perl:

5
use List::Util shuffle;    # Use the Shuffle module
166
167
168
169
170
171
# define and populate the arrays
my @girlsnames = ('Erin','Anna','Joanne','Sally', 'Mary');    
my @boysnames = ('Adam','Ken','Tom','Paul','David', 'Sam'); 
 
@girlsnames = shuffle @girlsnames;    # shuffle the girls' array
@boysnames = shuffle @boysnames;    # shuffle the boys' array
377
378
$name1 = pop(@boysnames);    # assign last name in array to $name1;
$name2 = pop(@girlsnames);    # assign last name in array to $name2;

WordPress Pages and Babysitting Rikuto

What did I do today?

I made a math worksheet about bus timetables, then I spent the rest of the day babysitting Rikuto while his mum was at work. We watched some Olympic volleyball, then played in the street on his little Thomas the Tank Engine train.

Rikuto is suffering from diarrhea at the moment which means after holding him for a while, my arms smell of poo.

What did I learn today?

global $post;
if(is_page() && $post->post_parent) {
     echo "do something";
}

That little conditional works on WordPress. If you paste it into a page template, you can determine whether or not the page is a parent or child. It’s really saying, “If this is a page and it has a parent, it must be a child so (do something)”.

What did you learn today?

New LongCountdown Theme

For the first time in ages, I’ve decided to ditch my own homemade WordPress theme and use somebody else’s instead. I chose the Amazing Grace theme by Vladimir Prelovac, and spent most of the day customizing it. I think Vlad’s theme is one of the better free ones, and I chose it because it was WordPress 2.6 compatible, with support for widgets, gravatars and a few other features. Yes, Jason convinced me to upgrade to WordPress 2.6.

With the extra space, I’ve been able to bring back the JapanSoc web widget and recent comments, as well as keeping the 20-man “Most Comments” list which I use as a dynamic blogroll.

I hope you like the theme. I do have another surprise up my sleeve, but I’ll keep you waiting for a while. ;)

Recent Posts in Category – WordPress Plugin

An example of the Recent Posts in Category plugin in action.Hot on the heels of my If Older Than’ plugin for WordPress, I’ve put together another little script that returns a list of recent posts from a category you specify. So, for example, if you want to show a list of the last 10 posts from your Japan Food category, now you can.

On the right you can see a screenshot of how I’m using it on one of my other websites. It’s especially suited to a newspaper-style blog, or a custom archive page.

If you like to prefer to use WordPress widgets and are afraid of editing theme files, then you might want to avoid this plugin (and all my others come to think of it!).

Otherwise, you can download it from my WordPress plugins page.

If Older Than – WordPress Plugin

It’s been a while since I made a WordPress plugin, but today I had the urge to put some ads on my blog, in places where my regular readers won’t see them. I could have used a plugin such as the Shylock Adsense Plugin, but it has far more options than I need. Instead, I made a little script to do this:

If Older Than WordPress Plugin Example

My plugins are WordPress Old Skool

NO fancy customization options in the admin panel, NO widgets, NO user support! My plugins need you to open your theme editor and paste some PHP into your template. If you can do that, you are old skool, too! :-P

Download from my WordPress Plugins page

Visit my new WordPress Plugins page to see what I’ve made (most are taken from my old website, Nice4Rice.com).

JapanSoc Toolbox

JapanSoc.com

Welcome to the JapanSoc Toolbox, a page full of resources to help you get the most out of Japan’s fastest growing social bookmarking site for the foreign community.

I’ve listed them in order of release, with new additions added as they become available. Please let me know if any of them are broken.

The JapanSoc Bookmarklet – Submit while you surf

JapanSoc Bookmarklet

The bookmarklet is added to either your browser’s bookmarks or links bar. You can submit a page to JapanSoc just by clicking this button, saving time and encouraging you to submit more articles! Find the bookmarklet on your JapanSoc profile page and read the instructions for the browser you use. Note: As an alternative, consider the Nipponster Toolbar described below.

JapanSoc Social Bookmarking Button

JapanSoc Social Bookmarking Button

This handy little button can be added to the foot of your blog posts, allowing your readers to submit your articles to JapanSoc. If you’d like to include a JapanSoc button on your site, grab the code and buttons from How can people soc my articles? on the JapanSoc FAQ.

JapanSoc FeedBurner FeedFlare

JapanSoc FeedBurner FeedFlare

What you see in that image above are links at the foot of a FeedBurner RSS feed. Clicking the JapanSoc link allows you to submit an article directly from the feed, which is incredibly useful if you use a feed reader such as Google Reader. The JapanSoc FeedFlare was created by Ken from WhatJapanThinks.com and can be used by anyone who has burned their feed with Feedburner. If you’re confused, watch the introduction to FeedBurner video in this DailyJ post, and then read Ken’s article so you can implement the JapanSoc FeedFlare into your own feed.

JapanSoc Voting Button

JapanSoc Voting ButtonThe JapanSoc Voting Button is the best way to encourage your readers to submit and soc your posts. It’s the most visual button and screams to be clicked! Although I’ve only tested the plugin for WordPress.org blogs, there is code you can copy and paste into your site to make it work on non-Wordpress blogs. If you’re looking for interactivity with your readers, more socs and more exposure, then this is the tool for you! Read more about the voting button.

Update: The WordPress plugin for the JapanSoc it! button is now available directly from WordPress. Read about the updates here: New JapanSoc it! Button. April 14th, 2009.

Nipponster Toolbar with JapanSoc It! Button

Nipponster Toolbar

This toolbar is unique in that it is designed for people like us. You’ve got a Japan-specific search engine, English-Japanese and Japanese-English translation tools, other useful links and gadgets, and of course, there’s a JapanSoc It! button, so you can submit articles while you surf. You can download the toolbar here.

JapanSoc Widget for Mac OS X

JapanSoc Widget for OS X

This flash-looking widget was designed by RockingInHakata author, Deas Richardson. About this tool, he says:

I whipped up an OS X widget to display the five most recent top stories AND allow me to submit new stories to JapanSoc directly from my Dashboard. I tried to keep the colors consistent with the actual site as well. If you are a JapanSoc member, or looking to be one, maybe you’ll find some use for it?

I’d love to try it, but since I don’t have a Mac, I have to settle for the video of the widget in action on Deas’ JapanSoc OS X Widget post. Incidentally, he has also made a Nipponster widget for the above mentioned, Japan-specific search engine.

JapanSoc RSS Web Widgets

JapanSoc Web Widgets

These two web widgets are an alternative to using the FeedList plugin above if you don’t have a WordPress blog. They can be embedded in sites such as iGoogle, Facebook, MySpace, Blogger and WordPress, too. Each widget represents a different JapanSoc feed; the orange one is for the main Top Stories feed, while the blue one is for Upcoming Stories. You can even customize their appearance by changing the colors and showing summaries of each story.

Stay up-to-date and keep you readers informed of the latest headlines from JapanSoc with the JapanSoc Web Widgets!

Additional Resources

Check out and bookmark this blog’s JapanSoc Info page. It has become the home for all things “JapanSoc”.

JapanSoc Voting Button for Blogs

By now you’ll know that I’ve started a social bookmarking site for everything Japan-related. If you’ve registered for JapanSoc and write about Japan on your own blog, then you’ll probably want this Digg-style voting button on your site.

Update: The WordPress plugin for this button is now available directly from WordPress. Read about the updates here: New JapanSoc it! Button. April 14th, 2009.

What does the button do?

Example of the JapanSoc Voting ButtonIt allows your readers to easily submit your blog posts to JapanSoc, and then automatically shows how many votes, or socs, your article has received from other JapanSoc’ers. After an article has been submitted, clicking the button will send your readers to JapanSoc where they can vote, or otherwise to the login/registration page.

Why should I use it?

It should encourage more of your readers to sign up for JapanSoc and vote for your posts, giving you more exposure on the social bookmarking site, and bringing new visitors to your blog.

How do I add it to a WordPress blog?

If you are running your own WordPress blog, then follow these instructions:

  1. Download the JapanSoc WordPress plugin
  2. Upload the japansoc folder to your wp-content/plugins folder
  3. Go to Admin -> Plugins, scroll down to JapanSoc: Soc it!, and click activate
  4. From the HTML tab, type <!--japansocleft--> or <!--japansocright--> in your post where you want the button to appear

How do I add it to a non-Wordpress blog?

If you don’t have a WordPress blog, you can still use the button, but you must be able to to insert Javascript directly into your post, or be able to edit your blogging template directly.

To add a button on a page with a single post, just copy and paste this:

<script type=”text/javascript” src=”http://www.japansoc.com/evb/button.php”></script>

If you have a page with multiple posts, you can separate each instance of the button by using the two lines of code below, and providing a url for each post.

<script type=”text/javascript”>submit_url = ‘url of the post‘;</script>
<script type=”text/javascript” src=”http://www.japansoc.com/evb/button.php”></script>

Thanks to the Xorsyst, creator of OtakuStuff.com

Credit for the JapanSoc Voting Button goes to Louis from Xorsyst.com, one of the oldest blogs I’ve come across, with content dating back to early 2002!

OtakuStuff - Social Bookmarking for OtakuOne of his latest articles announced the launch of OtakuStuff.com, a social bookmarking site for fans of Japanese anime, manga, games and cosplay. In building the site, Louis made the above WordPress plugin, and was kind enough to share it with us at JapanSoc. If you’re an Otaku, make sure you sign up for OtakuStuff and get the Moe It! version of this voting button for your blog.