Ever wanted to be a expert in WordPress or have tried to resolve you basic blog issue? Here’s some nice tips that can really lead to learn cool things about wordpress. You must have some basic editing capability in wordpress and basic know how to PHP to perform below tweaks and home them!
Let us know in a short comment about which one is your favorite !! Want more of cool stuff?? Follow us @facebook @twitter.
1. Show Specific content on Front Page Only
If you want to show some image file, some DIV or any link just on the front page of your blog either in header, footer or in sidebar; Here’s a tweak to do that. Use below PHP tweak
Want to know more about tweak, Go to WordPress support for complete usage guide.
2. Get Custom Field Value
This is very useful thing while you are dealing with thumbnails. You can use WordPress custom fields to get value transfered to your code from post. Many functions are used for same purpose, Best of them are illustrated below:
Function 1
$thumbnail = get_post_meta($post->ID, 'thumb', $single = true);
Now use the variable $thumbnail at any place to echo the value of custom field thumb, you can change the value of preview to your desired one!
Function 2
$image = get_post_custom_values('img');
Same like the above function but this function will return the value in $image array, so you will have to use something like below to get the custom field value:
echo $image[0];
3. Adding some content between posts
Talking about home page, what if you want to place some text, image or some news after 2nd, 3rd or any number of post? Here we have a tweak!! You can use conditional statement(if else) with-in the PHP while loop. Let me show that for you!
Below is the normal PHP loop that you can find in your templates index.php file or default.php
Not Found
This is normal index.php page to show the posts. So how to trick for adding content between posts? This code should look like below:
Not Found
So this was it and is simplest enough to understand. If you’re new to conditional statements, Learn them Here.
5. Add Breadcrumbs To Your WordPress Blog
Well its not fair to just write every code for you everytime, you can get help with plugins too. First lemme ask do you know Breadcrumbs?? for those who don’t, its a simple way to let your visitors know where they are now on your website. Breadcrumb trails are a good supplementary navigation system that aid in site usability. This plugin allows you to add breadcrumbs to your theme.
After installing the plugin just call the function like mentioned below:
5. Get FeedBurner Subscriber Count
Purely inspired from Hongkiat, the simpler way to show the subcscriber count is to page the below function to anywhere in you template, probabily in functions.php or funtion.php. Remember to replace the Feedburner-id with yours one!
//get cool feedburner count
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburner-id";
//Initialize the Curl session
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $whaturl);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
//end get cool feedburner count
And its done!! use below function to display the count at your desired place now.
echo $fb;
Cheers!! Folks
About Author
Nasir is passionate about Web technologies, Design Art and Video games and he really think code *is* art. It’s a well known fact that following me him brought people great fortune and a lot of cuddles! Check out his blog ThemesBank or Follow him @facebook @twitter