Posts Tagged ‘Echo’

Get Image from Post, a Free WordPress Plugin

As with many of my free WordPress plugins here on the website this one is used extensively throughout my website to help me deliver a great site for my visitors. The plug basically allows users to grab an image from their posts and display it in the Loop.

It’s perfect for home pages, archives etc. where you link to include a visual idea of what the posts about.

This is a simple plugin which allows users to return an image from the related post.

Please feel free to download this plugin.

Installation

To install the plugin, please upload the folder to your plugins folder and active the plugin.

== Frequently Asked Questions ==

= How do I display the results? =

Insert the following code into your WordPress theme files: 

= General results =

ithout passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.

 get_image_from_post();

= Altering the before and after values =

By default the plugin wraps your code in list item (<li>) tags but you can specify how to format the results using the following code:

 get_image_from_post(‘before=<p>&after=</p>’);

= Adding a Link = 

If you’d like to link to the post (remember it’s not live yet) you can do so by calling:

 get_image_from_post(‘link=true’);

= Echo vs. Return =

Finally, if you’d like to copy the results into a variable you can return the results as follows:

 get_image_from_post(’show=false’);

Get Better Excerpt Plugin for WordPress

The Get Better Excerpt plugin works almost identical to the built in get_the_excerpt() and the_excerpt() functions except it returns whole words instead of cutting off the excerpt as the existing function does.

The plugin allows you to display the excerpt or read it to a variable, select the number of words to return and choose if you want the plugin to skip the built in excerpt and read from the content instead.

As with all my plugins, this is the code I use here on this is my url to return excerpts throughout the website. You’re free to download it.

Frequently Asked Questions

= How do I display the results? =
Insert the following code into your WordPress theme files: 
= General results =
ithout passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.
 get_better_excerpt();
= Altering the before and after values =
By default the plugin wraps your code in list item (<li>) tags but you can specify how to format the results using the following code:
 get_better_excerpt(‘before=<p>&after=</p>’);
= Adding a Link = 
If you’d like to link to the post (remember it’s not live yet) you can do so by calling:
 get_better_excerpt(‘link=true’); 
= How many words? = 
You can specify the number of words returned using the option:
 get_better_excerpt(‘words=20′); 
 
 = Skip the excerpt? = 
If you would like to load the content directly, skipping the entered excerpt:
 get_better_excerpt(’skipexcerpt=true’); 
 = Include a trailing character? = 
By default the plugin includes a … after the excerpt, you can remove it or change it by altering:
 get_better_excerpt(‘trail=’); 
= Echo vs. Return =
Finally, if you’d like to copy the results into a variable you can return the results as follows:
 get_better_excerpt(’show=false’); 

 

New Updates to WordPress Plugins

This week I took a little bit of time and cleaned up some inconsistencies on my four new plugins, here’s a quick summary:

Easy Technorati Tags for WordPress

I’ve added a new menu and improved instructions for how to include the Technorati tags in your blog posts.

Easy Popular Posts

There’s a new admin menu for the plugin, and I’ve fixed an error in the documentation which incorrectly labeled echo as an option.

Easy Random Posts

There’s a new admin menu for the plugin, and I’ve fixed an error in the documentation which incorrectly labeled echo as an option.

Easy Scheduled Posts

There’s a new admin menu for the plugin, and I’ve fixed an error in the documentation which incorrectly labeled echo as an option. I’ve also added a new option to the function which allows you to control wether to link to the scheduled post or not.

All four plugins are available for free download and are compatible with WordPress 2.0.x -> 2.7.1, if you have any questions please feel free to drop me a line.

How to check to see if there are pages or posts before displaying in WordPress

When I’m programming a new theme in WordPress I’ll often want to check to see if there are going to be any results before I write content to the page, but often the process of calling the results will display it.

For example, if I want to list a series of pages inside a <ul> tag I first want to know if there is going to be a list of pages to write otherwise I will be writing an opening and closing <ul></ul> with nothing in the middle or worse, a title as well. To avoid this, here’s what I do:

[source lang="php"]<?

$list = wp_list_pages(‘echo=0′);

if ($list) {
echo "<h2>My pages</h2>";
echo "<ul>";
echo $list
echo "</ul>";
}

?>[/source]

The code example above simply uses the echo=0 option to preload the page list results into a variable called $list, next I simple check if $list has a value and if it does, I write the header and <ul> tags as well as the variable $list. If there are no pages, nothing is written.

 

I’ve build a similar function into three recent plugins, where you can preload the results into a variable using a show attribute by setting the value to false:

  1. $list = scheduledPosts(’show=false’);
  2. $list = randomPosts(’show=false’);
  3. $list = popularPosts(’show=false’);

Easy Scheduled Posts for WordPress

While I was working on my new theme for thisismyurl.com I came across the need to publish a series of scheduled posts in the side bar and so I put together a simple plugin for WordPress. The tool works like most WordPress theme calls and features:

  • Customizable number of links returned
  • Customizable before and after to ensure you can display the results
  • The ability to echo or return results

To use the plugin, install it to your WordPress website and edit your theme files by placing the following code:

General results
Without passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.

[source lang="php"]&lt;?php scheduledPosts();?&gt;[/source]

Specific number of results
If you would like to return a specific number of results as your maximum:

[source lang="php"]&lt;?php scheduledPosts(‘count=10′);?&gt;[/source]

Altering the before and after values
By default the plugin wraps your code in list item (<li></li>) tags but you can specify how to format the results using the following code:

  • [source lang="php"]&lt;?php scheduledPosts(‘before=&lt;p&gt;&amp;amp;after=&lt;/p&gt;’);?&gt;[/source]

    Echo vs. Return
    Finally, if you’d like to copy the results into a variable you can return the results as follows:

    [source lang="php"]&lt;?php scheduledPosts(‘echo=false’);?&gt; [/source]

    Download the plugin

     

    Support forums are now online! If you have any questions, please visit http://forums.thisismyurl.com.

  • Easy Popular Posts Plugin for WordPress

    While I was working on my new theme for thisismyurl.com I came across the need to publish a series of popular posts in the side bar and so I put together a simple plugin for WordPress. The tool works like most WordPress theme calls and features:

    • Customizable number of links returned
    • Customizable before and after to ensure you can display the results
    • The ability to echo or return results
    • Let’s you control how popular a post should be

    To use the plugin, install it to your WordPress website and edit your theme files by placing the following code:

    General results
    Without passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.

    [source lang="php"]&amp;lt;?php popularPosts();?&amp;gt;[/source]

    Specific number of results
    If you would like to return a specific number of results as your maximum:

    [source lang="php"]&amp;lt;?php popularPosts(‘count=10′);?&amp;gt;[/source]

    Altering the before and after values
    By default the plugin wraps your code in list item (

  • ) tags but you can specify how to format the results using the following code:
    [source lang="php"]&amp;lt;?php popularPosts(‘before=&amp;lt;p&amp;gt;&amp;amp;amp;after=&amp;lt;/p&amp;gt;’);?&amp;gt;[/source]

    Echo vs. Return
    Finally, if you’d like to copy the results into a variable you can return the results as follows:

    [source lang="php"]&amp;lt;?php popularPosts(‘echo=false’);?&amp;gt; [/source]

    Minimum Comments
    To ensure you only return truly popular articles, you can limit the returned posts to posts with a minimum number of comments

    [source lang="php"]&amp;lt;?php popularPosts(‘comments=10′);?&amp;gt; [/source]

    Download the plugin

    Support forums are now online! If you have any questions, please visit http://forums.thisismyurl.com.

  • Easy Random Posts Plugin for WordPress

    While I was working on my new theme for thisismyurl.com I came across the need to publish a series of random posts in the side bar and so I put together a simple post randomizer for WordPress. The tool works like most WordPress theme calls and features:

    • Customizable number of links returned
    • Customizable before and after to ensure you can display the results
    • The ability to echo or return results

    To use the plugin, install it to your WordPress website and edit your theme files by placing the following code:

    General results
    Without passing any parameters, the plugin will return ten results or fewer depending on how many posts you have.

    [source lang="php"]&lt;?php randomPosts();?&gt;[/source]

    Specific number of results
    If you would like to return a specific number of results as your maximum:

    [source lang="php"]&lt;?php randomPosts(‘count=10′);?&gt;[/source]

    Altering the before and after values
    By default the plugin wraps your code in list item (<li>) tags but you can specify how to format the results using the following code:
    [source lang="php"]&lt;?php randomPosts(‘before=&lt;p&gt;&amp;after=&lt;/p&gt;’);?&gt;[/source]

    Echo vs. Return
    Finally, if you’d like to copy the results into a variable you can return the results as follows:

    [source lang="php"]&lt;?php randomPosts(‘echo=false’);?&gt; [/source]

    Download

    Download the plugin.

    Support forums are now online! If you have any questions, please visit http://forums.thisismyurl.com.

    How to create a Coming Soon page for WordPress

    Adding a Coming Soon! page to WordPress is surprisingly easy for website designers of all levels, there are a few ways to do it of course but here are two extremely simple and straight forward ways to ensure your WordPress website has a proper greeting page.

    Theme Switcher Reloaded

    A super cool, extremely easy way to create a Coming Soon! page for WordPress is to install the Theme Switcher Reloaded plugin and simply add a second theme to your install! Your second theme only needs a few things, I’ve included a free bare bones theme for you to use as your Coming Soon page, so all you need to do is:

    1. Download, install and activate the Coming Soon theme
    2. Download and install and activate Theme Switcher Reloaded

    Now that the general public can only see the Coming Soon! page, you’re free to add your second (real) theme and activate it using the Theme Switcher Reloaded plugin. Once you’ve added it, visit your homepage using the ?wptheme=[yourthemedirectoryname] option to view the working theme. Remember you have to be logged into the backend to see it!

    Adding a Template to Your Existing Theme

    If you don’t want to go to the trouble of installing the Theme Switcher plugin, you could also add a special page template to your directory with the following content:

    [source lang="php"]

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    /*

    Template Name: Coming Soon
    */
    echo "Coming Soon!";
    ?>
    [/source]
    Of course, you will then have to add a new Page to your website, make it the default homepage and change the theme. This option works well but causes the homepage of the site to always default back to a coming soon page, even for the developers. Tim has an article with detailed instructions on it here.

    By the way, if you think a Coming Soon! page has to be boring, think again! Check out these great Coming Soon pages at 25 Examples of Cool Coming Soon Page Designs – Part II