17 Jul 2010 @ 10:00 AM 

I got an inquiry from one of my blog’s readers about post pagination, which I used in my previous post. Well, it’s very simple. To split your post into separate sub-pages, simply use the WordPress Quicktag, <!--nextpage-->.

Remember the <!--more--> tag? It cuts the post where it’s placed when the post appears in the blog’s front page. The <!--nextpage--> tag, on the other hand, works as a ‘paginator’ for single posts, and divides them into sub-pages where they’re placed. You can have as many pages as you like (but don’t over do it).

For example (use the HTML view when inserting the quicktag):

<h3>Step #5</h3>
Consectetuer rutrum urna in, a molestie aliquam gravida, quam vestibulum ac. Consequat ut lacus tempus a ipsum, sociis urna sed, vel tellus maecenas, lorem maecena's tortor. At odio platea etiam. <strong>Euismod libero</strong> pretium accumsan pellentesque ac. Quam semper in vitae dictum eget, ipsum magna orci odio lectus. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit.

Please see the next page for the last 3 steps.
< !--nextpage-->
<h4>Step #6</h3>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, <em>totam rem aperiam</em>, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.

As you might have seen in my last post:

Screenshot: pagination

And we can even do it right now! (Make sure to click on Page 2)

Posted By: Blogie
Last Edit: 17 Jul 2010 @ 10:00 AM

EmailPermalinkComments Off
Tags
 11 Jul 2010 @ 9:17 PM 

Since WordPress 3.0 was launched, I’m sure you’ve noticed the Get Shortlink button below the post title input field in the Add New / Edit Post screen, beside the post’s permalink. (See image below.) It’s a nifty feature made available to us by good old WordPress.org for shortening our posts’ URLs. Clicking on it will give you a wp.me URL which will redirect to your blog post. (This post’s shortlink, for example, is http://wp.me/pqxl6-Y.)

If you promote your blog posts via Twitter or Plurk, you probably use a plugin for auto-posting to those online services. However, if you’re the type who wants to personalize your shout-outs that go with your blog post link — maybe so you can insert hashtags — you’d have to manually add the post URL yourself, don’t you? And if the URL’s too long, you’d have to use a URL shortener like bit.ly or tinyurl.com (or any of the scores of similar services), right?

Post screen: Get Shortlink

Not anymore. With wp.me shortlinks, your WordPress blog now has a built-in URL shortener! Don’t you just love WordPress!?!

But wait, there’s more!! (Am I sounding like a TV salesman already? :D )

What if you wanted to make the shortlink visible on the blog for everyone to see? That’s exactly what I did with my food blog. See, sometimes I go back to old posts and promote them on Twitter and Facebook. Instead of having to go inside the dashboard and get the shortlink from the Edit Post screen, I can now just go to the blog post (or even the search results page) and copy the shortlink from under the title. Take a look at this screen shot of a couple of front-page posts from Davao Delicious:

WordPress shortlinks

Notice the “[shortlink]” text below the titles? By using a WP template tag, I was able to output the shortlink of each post onto various locations of the blog: the main page, single posts, archives, and the search results page. (And my other blogs are sure to follow suit.)

Here’s how to do it. There is just one new template tag involved: the_shortlink(). This tag must be placed inside The Loop, otherwise it won’t work. And, according to the Codex, it will only work on WordPress sites that implement pretty permalinks.

<?php the_shortlink( $text, $title, $before, $after ); ?>

Here’s how my code looks like:

<div class="post-title">
	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
	<p class="post-details">
		Posted on <?php the_time('j F Y'); ?> by <?php the_author_posts_link(); ?>
		<?php the_shortlink('shortlink','','[',']'); ?>
	</p>
</div>

The first parameter, $text, can be any string that you’d like to be seen by your site’s visitors. The next parameter, $title, is for the tooltip text that will appear on mouse-over. If you leave it blank, the default is the post’s title. The last two, $before and $after are for HTML codes and/or more text that you’d like to appear before and after the shortlink.

All of the parameters are optional. However, leaving the first one blank will result in this text link: “This is the short link.” Kinda fugly if you ask me, so it might be best to supply your own expression.

That’s it! Have fun with the WordPress URL shortener!

N.B.: Each post (and page, including the front page) actually has an assigned wp.me URL. If you view the page source, you’ll see the shortlink in the header. That is, if you’ve activated the WordPress.com Stats plugin and specified that the shortlink be published as meta data.

Posted By: Blogie
Last Edit: 11 Jul 2010 @ 09:17 PM

EmailPermalinkComments Off
Tags
Change Theme...
  • Users » 1
  • Posts/Pages » 344
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Contact



    No Child Pages.

About Me



    No Child Pages.