Browsing the blog archivesfor the day Thursday, July 1st, 2010.

Daily Tip: How to Embed RSS Feed Entries in WordPress Posts

Internet Marketing

If you want to list some of the latest posts from another site within one of your WordPress posts or pages, here’s a handy way to do it using a shortcode. First, add this to your functions.php file:

//This file is needed to be able to use the wp_rss() function.
>include_once(ABSPATH.WPINC.'/rss.php');
function readRss($atts) {
    extract(shortcode_atts(array(
	"feed" => 'http://',
      "num" => '1',
    ), $atts));
    return wp_rss($feed, $num);
}
add_shortcode('rss', 'readRss');

After adding that you can now use a shortcode to embed RSS:

[rss feed="http://wpmu.org/feed" num="5"]

It will look a little something like this:

CatsWhoCode.com

Post to Twitter Tweet This Post

No Comments

Daily Tip: How to Embed RSS Feed Entries in WordPress Posts

Internet Marketing

If you want to list some of the latest posts from another site within one of your WordPress posts or pages, here’s a handy way to do it using a shortcode. First, add this to your functions.php file:

//This file is needed to be able to use the wp_rss() function.
>include_once(ABSPATH.WPINC.'/rss.php');
function readRss($atts) {
    extract(shortcode_atts(array(
	"feed" => 'http://',
      "num" => '1',
    ), $atts));
    return wp_rss($feed, $num);
}
add_shortcode('rss', 'readRss');

After adding that you can now use a shortcode to embed RSS:

[rss feed="http://wpmu.org/feed" num="5"]

It will look a little something like this:

CatsWhoCode.com

Post to Twitter Tweet This Post

No Comments

Guide to Making Your WordPress Posts and Pages Print-Friendly

Internet Marketing

Having a “Print Page” button is especially important for WordPress sites used for education, course management, online magazines, project management, news sources, or any other informational site. The ability to easily print pages can have a significant impact on your reader’s experience with your website.

How frustrating is it to want to print a page from a site that has no print view? You either have to print a full page of ink or copy the relevant text into a document and print from there. This is very inconvenient and does nothing to promote your brand.

How to Add a Print Page Button to Your WordPress Theme

If you have a fairly minimalistic theme design and simply want to add a “Print Page” button to your posts or pages, just drop this snippet anywhere you want in your template files:

<script language="JavaScript">
  if (window.print) {
  document.write('<form> '
  + '<input type=button name=print value="Print Page" '
  + 'onClick="javascript:window.print()"></form>');
  }
</script>

Source: WP Special

However, if you really want to improve your user’s experience, you may want to add in a few more features than just the button to launch the printer. You can, of course, add print styles to your theme’s stylesheet, but this can get very tedious. If you want an easier way to accomplish this, skip to the plugin option below.

Plugin Option for Adding a Print Button to Posts and Pages

WP-Print

WP-Print will enable you to add a “Print This Page” button to your posts and pages with a small icon and a number of dashboard options: edit the print text link, select an icon, and decide wither or not you want to print individual items, such as comments, links, images, videos and a custom copyright text. When you click on the print button, you’ll be redirected to a print-friendly version of your post or page.

If you want to further customize how your print pages look, you can edit the print-css.css file included with the plugin. Change the text color, add a logo, change the width, and brand it for your site.

If you’re having trouble getting the print button to show up using the WordPress 3.0 2010 theme, you can add its template tag to the single.php or page.php:

<?php if(function_exists('wp_print')) { print_link(); } ?>

Adding easy printing capabilities may not be necessary for every site, but it certainly adds a touch of professionalism. Content printed from your website goes places that your site cannot go. Give your online presence some legs with a well-designed print page.

Post to Twitter Tweet This Post

No Comments