Display the total number of trackbacks on your wordpress

December 15, 2008

With a little modification, You can display the total number of trackbacks. we first have to create a function. paste the following code on the functions.php file from your theme: function trackback_count() { global $wpdb; $count = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_type = 'pingback' OR comment_type = 'trackback'"; echo $wpdb->get_var($count); } Once the file is saved, you can call the function anywhere you want: <?php trackback_count(); ?>  Read More →

Get wordpress permalink outside of the loop

December 15, 2008

If you want to get a permalink outside of the loop. Here’s how to do it easily. To get a permalink outside of the loop, you have to use the get_permalink() function. That function takes a single argument, which is the ID of the post you’d like to get the permalink: <a href="<?php echo get_permalink(10); ?>" >Read the article</a> You can also use this function with the $post global variable: <a href="<?php echo get_permalink($post->ID); ?>" >Read the article</a>  Read More →

Save time by using WordPress shortcodes

December 13, 2008

Shortcodes have been introduced in WordPress 2.5. They’re hooks which allow you to call a php function simply by typing something like [shortcode]. It is a great way to save time on repetitive tasks. Just read on to find out how to use them. To create a shortcode, you first have to create a php function. Let’s start with a basic one. Append it to your functions.php file. function caption_shortcode($atts, $content = null) { return 'Welcome~~'; } Once you created your function, you have to use the add_shortcode() function.... [Read the full story]

Finding Window Dimensions with Javascript

December 13, 2008

Sometimes you may want to find the dimensions of the user’s browser window. Below is a list of the propertiesthat are accessible with different browsers. Traditionally, window.innerWidth/window.innerHeight is the most widely accepted way to obtain these values, however, there is deviation between IE 4 and IE 6+ in “standards compliant mode.” Below, I have listed the different ways to find the window height and width. Non-IE Browsers window.innerWidth window.innerHeight IE 6+ in “standards compliant mode” document.documentElement.clientWidth document.docuementElement.clientHeight IE... [Read the full story]

Redirect wordpress users to a specific url using a 301 redirection

December 12, 2008

Do you know that WordPress have a built-in function to redirect users to a specific url? It is called wp_redirect(). Many users don’t know it, but you can also create 301 redirections with that useful function. To create a 301 redirection within WordPress, you just have to add the 301 argument to the function: <?php wp_redirect('http://www.livexp.net', 301); ?> The above code will redirect anyone on this site. Don’t hesitate to use it.  Read More →

Page 4 of 7« First...«23456»...Last »