Why choose WordPress for your website

Here are 7 reasons why we use WordPress for a number of our websites.

Open Source Software

This basically means the software is free to download and use, this encourages innovation and creates a helpful community, willing to share it’s knowledge. Although as a novice you may want your developer to build your site, over time the help is there if you want it.

Easy to Install

Good web hosting companies offer quick one click installation of wordpress and have optimised systems to work seamlessly with the platform.

Great Themes

A theme provides the look of your website, there are many good free themes and premium (paid) themes available to give your site the feel you want. A developer can also customise an existing theme or create a fully customised theme tailored for your exact requirements.

Plugins

Plugins add additional features to your website, for example, if you want a fancy image a gallery there’ll be a selection of plugins available to you. If you are looking for any particular feature for your website there’ll probably be a selection of plugins available, many are free to use.

S.E.O

SEO (Search Engine Optimization) this is making your site search engine friendly and getting it to appear high up in the search engine results page. This area is constantly changing and be wary of companies who can promise miraculous results, however there are still a number of simple things you can do with your wordpress site to assist it’s performance.

Generally wordpress is very SEO friendly but there are also some excellent SEO plugins to fine tune your website.

Simple CMS

CMS (Content Management System) this allows the user to publish and edit their content easily and quickly. You don’t need to be an experienced programmer to update your pages, if you are used to using Word then updating the content will be simple.

Expandable and Adaptable

A wordpress business website can be as big as you want it to be, from a simple blog page to large website with a number of complex features including ecommerce. The website can grow and adapt as your business evolves.

Discuss Comment Plugin Comment Count Hook for WordPress

In your function.php add the following:
function disqus_count($disqus_shortname) {
    wp_enqueue_script('disqus_count','http://'.$disqus_shortname.'.disqus.com/count.js');
    echo '<a href="'. get_permalink() .'#disqus_thread"></a>';
}

Then on any page you want comment counts to appear add the following:

<?php disqus_count('myshortcode'); ?>

Display a snapshot of any website

Want to be able to take a snapshot of any website, and display it on your blog? This cool shortcode allows you to do so. Just paste the following code into your functions.php

function wpr_snap($atts, $content = null) {
        extract(shortcode_atts(array(
			"snap" => 'https://s-ssl.wordpress.com/mshots/v1/',
			"url" => '',
			"alt" => 'My image',
			"w" => '400', // width
			"h" => '300' // height
        ), $atts));
 
	$img = '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
        return $img;
}
 
add_shortcode("snap", "wpr_snap");

Ouput

[snap url="http://www.catswhocode.com" alt="My description" w="400" h="300"]

Menu Sitemap Shortcode

This code is for Sitemap page if you wish to have. this is a useful shortcode, just copy this to your functions.php

function menu_function($atts, $content = null) {
   extract(
      shortcode_atts(
         array( 'name' => null, ),
         $atts
      )
   );
   return wp_nav_menu(
      array(
          'menu' => $name,
          'echo' => false
          )
   );
}
add_shortcode('menu', 'menu_function');

Ouput

[menu name="main-menu"]

Jquery Script Function

I use this Functions to avoid conflicts and other potential problems, you’ll want to load jQuery using the following code. just copy this code to your functions.php. enjoy!

function my_init() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script('jquery'); 
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2'); 
wp_enqueue_script('jquery');
} }
add_action('init', 'my_init');

PDF Embed Shortcode

In this tutorial we discuss about pdf file. this code usually embed your pdf to the page that you can actually see the content of the pdf and you can set the width and the height. just copy this code into your function.php

function pdf_function($attr, $url) {
   extract(shortcode_atts(array(
       'width' => '640',
       'height' => '480'
   ), $attr));
   return '';
}
add_shortcode('pdf', 'pdf_function');

Usage

[pdf width="520px" height="700px"]http://static.fsf.org/common/what-is-fs-new.pdf[/pdf]

Toggle Box Shortcode

This code is to create toogle box in WordPress. Just Copy this code to your function.php

 function toggle_shortcode( $atts, $content = null ) {
 extract( shortcode_atts(
 array(
 'title' => 'Click To Open',
 'color' => ''
 ),
 $atts ) );
 return '<h3><a href="#">'. $title .'</a></h3><div class="toggle_container">' . do_shortcode($content) . '</div>';
 }
 add_shortcode('toggle', 'toggle_shortcode');

Then Add this code to your header before

<head>

tags.

jQuery(function($){
    $(document).ready(function(){ 
         $(".toggle_container").hide();
         $("h3.trigger").click(function(){
        $(this).toggleClass("active").next().slideToggle("normal");
        return false; //Prevent the browser jump to the link anchor
    });
    });
});

after that use this css for styling the toggle box.

h3.trigger {
    margin: 0px !important;
    font-size: 18px;
    padding: 10px;
    padding-left: 30px;
    background-image: url('images/shortcodes/toggle-plus.png');
    background-position: 10px center;
    background-repeat: no-repeat;
}
h3.trigger a {
    color: #333;
    text-decoration: none;
    display: block;
}
h3.trigger a:hover {
    color: #0489B7;
    text-decoration: underline;
}
h3.active{
    background-image: url('images/shortcodes/toggle-minus.png') !important;
    background-position: 10px center;
    background-repeat: no-repeat;
}
h3.toggle-white{
    background-color: #FFF;
}
h3.toggle-gray{
    background-color: #F5F5F5;
}
.toggle_container {
    overflow: hidden;
    padding: 20px 10px;
}

use this short-code to your post or page in WordPress

[toggle title="Your Toggle Title" color="white"]Toggle Content[/toggle]

Query Post Function Shortcode

This is a Query Post Function Shortcode in WordPress. Just copy this code into your functions.php

function myLoop($atts, $content = null) {
	extract(shortcode_atts(array(
		"pagination" => 'true',
		"query" => '',
		"category" => '',
	), $atts));
	global $wp_query,$paged,$post;
	$temp = $wp_query;
	$wp_query= null;
	$wp_query = new WP_Query();
	if($pagination == 'true'){
		$query .= '&paged='.$paged;
	}
	if(!empty($category)){
		$query .= '&category_name='.$category;
	}
	if(!empty($query)){
		$query .= $query;
	}
	$wp_query->query($query);
	ob_start();
	?>
	<h2><?php echo $category; ?></h2>
	<ul class="loop">
	<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
		<li><a href="<?php the_permalink() ?>" rel="bookmark"><?php echo $thumbnail_image; the_title(); ?></a></li>
	<?php endwhile; ?>
	</ul>
	<?php if(pagination == 'true'){ ?>
	<div class="navigation">
	  <div class="alignleft"><?php previous_posts_link('« Previous') ?></div>
	  <div class="alignright"><?php next_posts_link('More »') ?></div>
	</div>
	<?php } ?>
	<?php $wp_query = null; $wp_query = $temp;
	$content = ob_get_contents();
	ob_end_clean();
	return $content;
}
add_shortcode("loop", "myLoop");

Then use this shortcode sample:


ex:1 [loop category="news" query="" pagination="false"]
ex:2 [loop category="news" query="showposts=10" pagination="true"]

for custom template file use this code:
<?php echo do_shortcode('[loop category="news" query="showposts=5" pagination="true"]');?>

Fix Pretty Permalink in htaccess

In this Tutorial We discuss about how to fix post permalinks if your hosting does not allow it. so here is the solution for that, just copy this and paste to your htacces or open your notepad then copy this and save as .htaccess then replace your htaccess file to your cpanel.

# BEGIN WordPress

ErrorDocument 404 /index.php?error=404
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress