Posts list with offset

If you have your blog configured to show just one post on the front page, but also want to list links to the previous five posts in category ID 1, you can use this:

 <ul>
 <?php
 global $post;
 $myposts = get_posts('numberposts=5&offset=1&category=1');
 foreach($myposts as $post) :
   setup_postdata($post);
 ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
 <?php endforeach; ?>
 </ul> 

Note: With use of the offset, the above query should be used only on a category that has more than one post in it, otherwise there’ll be no output.

Posted in Tips. Tags: . Leave a Comment »

Add a Widgeted Footer Area in WordPress

Add a Widgeted Footer Area

A lot of bookstore sites having widgeted footer area. In my theme there is no footer widget so I m going to add four footer widget to my theme. Keep in mind that it’s always a good idea to make a backup copy of the style.css and footer.php files before trying this.

Step #1

The first thing to do is to register the widgeted footer areas in your theme’s functions.php file. Using the Lifestlye theme as an example, here’s what the code looks like right now:

if ( function_exists('register_sidebars') )
    register_sidebar(array('name'=>'Sidebar Top','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Sidebar Bottom Left','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Sidebar Bottom Right','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'468x60 Header Banner','before_title'=>'<h4>','after_title'=>'</h4>'));

And here’s what it will need to look like to register the additional areas:

if ( function_exists('register_sidebars') )
    register_sidebar(array('name'=>'Sidebar Top','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Sidebar Bottom Left','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Sidebar Bottom Right','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'468x60 Header Banner','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Footer #1','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Footer #2','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Footer #3','before_title'=>'<h4>','after_title'=>'</h4>'));
    register_sidebar(array('name'=>'Footer #4','before_title'=>'<h4>','after_title'=>'</h4>'));

Step #2

The second thing you’ll want to do is establish the proper style for the widgeted footer area. Because most StudioPress theme’s footer areas are defined as “footer”, I’m going to define the main “div” for the widgeted footer area “footer-widgeted”. You’ll need to add all of the CSS shown below to style.css, but I’ll break them out so you can see what each section is. Make sure if you’re theme’s width is less than 960px, you’ll need to adjust that below.

Main Container Styling

#footer-widgeted {
        width: 960px;
        margin: 0px auto 0px;
        padding: 0px;
        }

Paragraph Stlying

#footer-widgeted p {
        color: #333333;
        font-weight: normal;
        margin: 0px;
        padding: 0px 0px 10px 0px;
        }

Hyperlink Styling

#footer-widgeted a, #footer-widgeted a:visited {
        color: #333333;
        text-decoration: none;
        }
#footer-widgeted a:hover {
        color: #333333;
        text-decoration: underline;
        }

Unordered List Styling

#footer-widgeted ul {
        list-style-type: none;
        margin: 0px;
        padding: 0px;
        }
#footer-widgeted ul li {
        list-style-type: none;
        margin: 0px 0px 10px 0px;
        padding: 5px;
        }
#footer-widgeted ul ul {
        list-style-type: none;
        margin: 5px 0px 0px 20px;
        padding: 0px;
        }
#footer-widgeted ul li li {
        list-style-type: square;
        margin: 0px;
        padding: 0px;
        }
#footer-widgeted ul li ul li {
        margin: 0px;
        padding: 0px 0px 3px 0px;
        }

Widget Headline Styling

#footer-widgeted h4 {
        color: #333333;
        font-size: 16px;
        font-family: Arial, Tahoma, Verdana;
        font-weight: normal;
        margin: 0px 0px 5px 0px;
        padding: 0px;
        }

Widget Styling

#footer-widgeted .widget {
        background: none;
        margin: 0px;
        padding: 5px 0px 0px 0px;
        border: none;
        }

Widget Columns Styling

.footer-widgeted-1 {
        width: 215px;
        float: left;
        margin: 0px;
        padding: 20px 20px 5px 10px;
        }
.footer-widgeted-2 {
        width: 215px;
        float: left;
        margin: 0px;
        padding: 20px 20px 5px 10px;
        }
.footer-widgeted-3 {
        width: 215px;
        float: left;
        margin: 0px;
        padding: 20px 20px 5px 10px;
        }
.footer-widgeted-4 {
        width: 215px;
        float: right;
        margin: 0px;
        padding: 20px 0px 5px 0px;
        }

Step #3

Lastly, you’ll need to add the proper code to your footer.php file. Most StudioPress themes are coded similar, so this should work. Inside your theme’s footer.php file, look for this code:

<div></div>
<div id="footer">

Essentially, you’ll be placing the code below in between the two lines you see above. As a result, you’re code should look like this:

<div></div>
<div id="footer-widgeted">
    <div>
        <ul id="footer-widget-1">
            <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer #1') ) : ?>
                <li>
                    <h4><?php _e("footer-widgeted #1 Widget", 'studiopress'); ?></h4>
                    <p><?php _e("This is an example of a widgeted area.", 'studiopress'); ?></p>
                </li>
            <?php endif; ?> 
        </ul>   
    </div>      
    <div>
        <ul id="footer-widget-2">
            <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer #2') ) : ?>
                <li>
                    <h4><?php _e("footer-widgeted #2 Widget", 'studiopress'); ?></h4>
                    <p><?php _e("This is an example of a widgeted area.", 'studiopress'); ?></p>
                </li>
            <?php endif; ?> 
        </ul>   
    </div>      
    <div>
        <ul id="footer-widget-3">
            <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer #3') ) : ?>
                <li>
                    <h4><?php _e("footer-widgeted #3 Widget", 'studiopress'); ?></h4>
                    <p><?php _e("This is an example of a widgeted area.", 'studiopress'); ?></p>
                </li>
            <?php endif; ?> 
        </ul>   
    </div>      
    <div>
        <ul id="footer-widget-4">
            <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer #4') ) : ?>
                <li>
                    <h4><?php _e("footer-widgeted #4 Widget", 'studiopress'); ?></h4>
                    <p><?php _e("This is an example of a widgeted area.", 'studiopress'); ?></p>
                </li>
            <?php endif; ?> 
        </ul>   
    </div>      
<div></div>
</div>
<div id="footer">
Posted in Tips. Tags: . Leave a Comment »

WP e-Commerce



Over 500,000 + downloads, stability, security and tight WordPress integration make it the right choice for growing your business online.

  • icon

    WordPress Integration

    You will install WP e-Commerce in minutes. Just like all well architectured plugins WP e-Commerce bolts right on. You simply download the plugin, copy it to your Plugins folder and activate it via your admin panel.

  • icon

    More Sales & More Hits

    WP e-Commerce integrates seamlessly with the WordPress Update System – so when you upload a new product the world knows about it!

  • icon

    Social Networking

    We help ensure your site is a success by providing you with a range of tools that allow you to import your products into the Facebook Marketplace and Google Base. WP e-Commerce also utilises the populor “Share This” plugin so that your happy customers can bookmark and promote your products too!!!

  • icon

    Payment Options

    WP e-Commerce makes it easy for you to accept payments online. WP e-Commerce integrates with Google Checkout, Paypal, Authorize.net, Payment Express and many other trusted payment processors.

  • icon

    One Page Checkout

    Evidence has shown that the less pages your customers have to browse to make a purchase the more sales you will make. WP e-Commerce is streamlined, quick and simple to use so that your customers have a great experiance shopping your site.

  • icon

    Design Perfectionist?

    Not only do you get to choose from a range of slick store front styles but you can customize and tweak your site to look however you want. We have made it easy for you by utilising WordPress PHP template tags, WordPress shortcodes and WordPress Widgets.

  • icon

    Community & Support

    Read our documentation and peruse our forums. Our forums have hundreds of resolved questions and there is a great and growing network of people to help you start selling online!!

  • icon

    Extend WP e-Commerce

    We understand that different sellers have different needs so we have developed specific modules to cater for musicians, designers and people wishing to setup members only and subscription sites.

  • icon

    The Biz

    We have been developing the WP e-Commerce solution for over 4 years. We have listened to hundreds, if not thousands, of sellers and based on this unparalleled experience we have forged the best WordPress e-Commerce solution ever.

Shopping cart for WordPress

Here’s a great way to add a shopping cart to your WordPress blog so you can sell products directly from your site without the user having to go to an external site. If you offer products for sale on your blog, it’s much nicer for your customers to stay on the same site that they see the products on.

This plugin is simple and powerful, it uses AJAX for some parts of it and it seems to work just dandily on the blog I have installed it on. Here’s how you do it…

[expert instructions]
Download plugin, upload to plugins directory, activate it.
Visit the ecommerce tab and set options for country and currency, edit categories, edit checkout options, edit gateway options, add products.
sell!
[/ expert instructions]

[Hand hold instructions]
First, get yourself a copy of the WP Shopping Cart plugin and upload it to your plugins directory, go to you plugins page and activate it :

wp shopping cart plugin activate

You should see a new tab at the top of the dashboard labeled ‘ecommerce’ . Click that and we can set up the options for our country and tax rate. Just select your country from the pull down box and it should set the tax rate for you.

You can also require someone to be registered before they can purchase products. This is up to you, for now, you can leave it as ‘no’. The only problem with requiring a user to register first is the non-immediate way in which WordPress allocates a password to a user by emailing it to them. Also, once someone logs in to your site, they get presented with the dashboard and not the site but there’s a great plugin to use to beat that here.

Leave the URL settins for now, they’ll work just find and dandy as they are (they may look different on your setup if you have a different permalink structure)

Choose your language and keep the theme as default:

shop options

Next, you need to choose your cart location. I use the setting as a widget because this blog is widget enabled. You can choose to add it manually yourself by inserting the code to anywhere on your sidebar if widgets aren’t your thing.

Choose which options you want and be sure to choose the correct currency setting for your country:

shop options2

The next section asks you if you want to charge shipping, if you are selling physical products then you need to choose ‘yes’ and set the base shipping charges. (base charges are standard and only added once regardless of how many products are added to the cart, you can add additional delivery charges on the product settings) :

shop options3

Click ’submit’ and that’s one page done!


Now to edit category and products…Click on the ‘categories’ tab for ecommerce and then on ‘edit’ next to the example category and put in your own options and click ‘edit category’ when you are done:
Category options


Now, add your products!
Click on the ‘products’ tab and choose the category you want to add products to from the pull down box. Just add the options you want..Product Name:
Description:
Additional Description:
Choose the categories for the product by ticking the boxes for each category:
Choose a brand if you are using one:
Enter the price of the product you are selling:
Product Options

The next option is stock control, if you are selling physical products then you can tick the box for ‘limited items’ and it will give you a field for putting how many items of this you have, once you run out the software wont show this product any more until you get more stock and edit the amount here.

Variation control is a way to add options to a product, like size for a t-shirt or a colour choice which will be selectable on the product description page before a customer adds the product to the shopping cart.

Additional shipping costs can be added so that each item that is added to the cart will also add that amount to the shipping (good for heavy items)

Product images are self explanatory and always a good idea to use a decent picture for your product, the plugin does a good job of creating a thumbnail and uses AJAX to display the full size image when a customer clicks it. (choose your thumbnail size or upload a seperate thumbnail if you want)

Product download is for digital items.

Click ‘add product’ to save your product settings:

Product Options2

If you don’t want tax added to each item or it is already included in the price then select the option to ‘do not include tax’.


Payment options. You need some way to allow payments right? this shopping cart only gives you the option to receive money by Paypal, the customer can use their paypal balance or a credit card to purchase your products and the money will be received into your paypal account.First, go to the ‘payment gateway’ tab and select ‘paypal’ from the pull down box, you’ll presented with a screen to add your details.Enter your paypal email address:
Paypal IPN is the paypal instant payment notification, if you’re selling physical products then you probably wont need this.
Paypal accepted currency is what your paypal account is set up for.
Forms: just use the pull down boxes to select the correct fields for each title (use the top set of options on the pull down boxes):
Gateway options


Checkout options: This is the last screen you have to edit, the default is set to ask the customer to input their cardholder address and shipping address but I think it’s better to just use the cardholder address (for anti-fraud purposes).To remove the shipping details fields, just click the trash can icon on the side of each field to remove it, you can add other fields too like a text area for added delivery instructions etc. I make sure that the ‘mandatory’ option is selected for the postal code too.Choose the option for ‘paypal/credit card only’ if you don’t plan on letting your customers pay manually by check or other option:
Checkout options


That’s the settings done, now we have to add the widget and perhaps don’t display certain pages that were added by the plugin to your tabs or ‘pages’ list..You can add the shopping cart by visiting ‘presentation/widgets’ and dragging the cart button to wherever you want:
Widget optionsIf you have noticed the extra pages being displayed on your blog and you don’t want them, simply change the template code for the page list display options. You will need to know the post id of each of these pages so click on ‘manage/pages’ to see a list and note down their respective id’s and use an ‘exclude’ option in your template wherever there is a ‘wp_list_pages’ function. eg:

[php]wp_list_pages(‘exclude=4,5,6′ ); [/php]


That’s it! you should now have a products page showing your products and when someone clicks ‘add to cart’ , it will AJAX it over to the shopping cart ready to be checked out:
product added

Once ‘checkout’ is pressed, the customer is presented with the screen to add their address details:

Checkout

Once that is filled in, they click ‘make purchase’ and will be sent to the paypal login page where they can use their paypal account or pay by credit card if they don’t have an account already:

paypal screen

You will be able to see a record of what purchases have been made on the first tab of the ‘ecommerce’ section:

Purchase log


There you go! This is just a quick and dirty way to get a shopping cart on your blog, you can play around with lots of options to your hearts content if you have many products or want to offer digital downloads. There’s even a widget to add a donation button to your blog and have that go in the shopping cart.Personally, I like this way of selling on your blog and have used this (edited) plugin on a commissioned site using a very simple (and very edited) WordPress 2.3 theme, the customer loved it!

Stylish Text Generator for Orkut, MySpace, FaceBook

Stylish Text Generator you can use to create an alternative text like pattern to make your name look little different. Use it on My Space, Facebook, Orkut or any other social networking site.