How to show related product any where in magento

1. Copy and paste this code in your template page.

<!--- Code Start from here   -->

<div class="related_product"><?php $related_prods = $_product->getRelatedProductIds();foreach($related_prods as $related){   $_item = Mage::getModel('catalog/product')->load($related);    //echo $_rel->getName() . " " . $_rel->getSku();  ?>

Auto-Resize WordPress Featured Image

Auto-Resize WordPress Featured Image and Crop if Necessary

If you are creating a WordPress site for a user, you want to make sure everything is as easy as possible for them. One trick that can make things easier is to have images automatically resize when they are used for a featured image in WordPress. Resizing images may be easy for developers and graphic designers, but some end-users don’t have the skills or time to resize an image to fit perfectly in your design. Luckily, this is simple to set up.
 Steps
  1. Before we even start, make sure that your theme supports thumbnails. To do this just make sure the the following line of code is in your functions.php file.
add_theme_support( 'post-thumbnails' );
  1. The next step is to put the following line of code in the WordPress theme’s functions.php file.
add_image_size($name, $width, $height, $cropBoolean);
  1. The add_image_size(); function has 4 parameters. $name is the name that you want to call your image with. $width is the width you want the image to crop to in pixels. $height is the height you want the image to crop to in pixels. $cropBoolean is a true or false parameter. If set to true the image will crop itself automatically.
  2. In the example below, the name I use to call the cropped image is “featuredImageCropped”. The height and width are 250px and 200px respectively, and the image is set to crop.
add_image_size('featuredImageCropped', 250, 200, true);
  1. The next step is to reference the new image size in your theme. Place the following code wherever you would like to see your cropped image:
<?php the_post_thumbnail('featuredImageCropped'); ?>


Pagination In PHP

<?php
$page = 1;

if(isset($_GET['page'])){
$page=$_GET['page'];

}

$conn=mysql_connect('localhost','root','');
mysql_select_db('test',$conn);
$result_num_PerPage = 5;
$startResults = ($page - 1) * $result_num_PerPage;
$number_Of_Rows = mysql_num_rows(mysql_query('SELECT id FROM page',$conn));
$totalPages = ceil($number_Of_Rows / $result_num_PerPage);
$select = mysql_query("SELECT * FROM wp_usermeta LIMIT $startResults, $result_num_PerPage",$conn);


How to Display Recent Posts From A Specific Category In WordPress

<?php
$catquery = new WP_Query( 'cat=3&posts_per_page=10' );
while($catquery->have_posts()) : $catquery->the_post();
?>
<ul>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>

<ul><li><?php the_content(); ?></li>
</ul>
</li>
</ul>
<?php endwhile; ?>

At the top where it says showpost= change the number to how many posts 
you want to display, and cat=3 is the id of the category, so change the 
ID of the category to pick which category will you be displaying.

How to integrate Print Command in any web page

1. Coding Start from here

<html>
<body>
<div id="printTable">
Lorem Ipsum is simply dummy text of the printing and typesetting 
industry. Lorem Ipsum has been the industry's standard dummy text 
ever since the 1500s, when an unknown printer took a galley of .

</div>