In single.php file we have function to add comments functionality. Here in this article I will give the code for customize the comments template.
From wordpress 2.7 version we got the functionality of changing or customizing the comments template as per your theme. As we all know in single.php file we called following function to add comments functionality. wordpress comments is very important functionality. Here in this article I will give the code for customize the comment template.
This function basically calls the comments.php file and add the data from wordpress database.
If we check the comments.php file. Usually we are having following content in comments.php file
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
<p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
<p>Logged in as<a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo$user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>"title="Log out of this account">Log out »</a></p>
<?php endif; // If registration required and not logged in ?>
88
</div>
89
90
<?php endif; // if you delete this the sky will fall on your head ?>
91
</div>
In the comments loop for showing the comments we used the wp_list_comments() function. Use this for customize the comments template.
We can customize this function as per our requirement. We can pass the following parameters to this function. use following for customize the comments template.
[/viral-lock]
For customize the comments template following parameter is important.
callback (string) The name of a custom function to use to display each comment. Defaults to null. Using this will make your custom function get called to display each comment, bypassing all internal WordPress functionality in this respect. Use to customize comments display for extreme changes to the HTML layout. Not recommended.
In my theme I used that in following way. I changed and passed parameter in comments.php file.
Many times some people add the full URL of website in the name parameter. That time showing author name of comment writer is looks so ugly. So I used following trick in this function. Using this line of code we can show only 20 characters of author.
Given code for wordpress create archive page for wordpress theme. search engine sites will look for two main file. First sitemap.xml file and archive page. First I would say somthing about archive page in any website. Archive page is very important for SEO purpose.
Create an Archive Page in your WordPress theme
If you do not having archive page in your website so you are lacking somewhere in SEO for your website. What I am going to show in this article, How to create the archive page for worpdress theme or website. In wordpress creating the archive is very easy.
Follow my steps to create the archive page in wordpress site.
Open your wordpress theme folder and copy the single.php as named archive.php
Note: dont copy index.php file as archive.php. It may have different UI and programming attribute in index.php.
Then copy archive.php as archive_template.php new file.
Open the archive_template.php file and copy paste the following code in top of file.
Many people want to know about post category and know more information current category. Some time we need to use the first category of wordpress post. As we know we can define the multiple category to single article. So if we want retrive the wordpress category then we will get the result in simple php array format. Using that array we can easily extract the first category of post.
if we want first category than, we will get result in php array format. Using that array we can easily get first category name or id from wordpress post.
How to get first category name or id from wordpress post
In this post I will show how we can achieve that. Using following code we can get the first category ID.
wordpress tutorial, How to use Custom Page as Homepage in WordPress. Here we given full step by step explanation about using custom template.
This is one of the most wanted hacks that users want to know how to accomplish. First you need to learn how to create a custom page. You will need to duplicate your page.php or create a wordpress.php file and add the following code at the very top:
How to use Custom Page as Homepage in WordPress
wordpressapi */ ?>
How to use Custom Page as Homepage in WordPress
You can change the template name. Change any styling, that you want in that page. Go to your WordPress admin panel and create a new page and select this template(wordpressapi).
Select your page to be the homepage as per your choice. Now you have yourself a Custom Home Page.
We use to write my wordpress blog daily. That is like our habit. That is like my habit. WordPress visual editor is so good. We need to login each time to wordpress and write a blog post. page refreshing, checking post that part is boring. List of Desktop application for WordPress.
Desktop application for WordPress post
So I looked for solution to write blog from desktop application. I found very use full application which is free for wordpress.
Summary: This software is excellent! This is what I had in mind when I set out to find desktop blogging software for wordpress. The usability is excellent. Initially, I expected some type of configuration wizard or walk-through. Instead, what I received was a panel that had the steps with links on how to set up my blog for Zoundry lovin’. I believe it worked better than a walk-through could have, since it taught me the way to set up another blog if I needed it. This app got out of my way and let me do what I set out to do. Zoundry was definitely built by a programmer with excellent usability experience.
Advantages:
Automatic blog-type discovery (just provide the URL!)
Easy to set up accounts
Imports your blog posts
Getting started tab guides you through blog set up
HTML validator built into the code view (big plus)
WYSIWYG features still usable in code view
Includes a publish menu to finalize your decisions, tags, trackbacks, etc.
Disadvantages:
Scroll wheel on my mouse crashed the entire app on the publish menu. Luckily, Zoundry has an auto save feature which recovered the post I had started. Nice.
Some time we want to show Some custom text or HTML code on home page. In this article we given tricks and steps to add HTML code on WordPress home page.
How to add HTML code on WordPress home page
First method
you need go to wordpress admin panel.Create page with home name. Add your HTML or custom text in that page.
Go to Setting->reading section. There is “Front page displays” section. We can found following two radio box over there.
Your latest posts
A static page (select below)
Select “A static page (select below) ” radio box. Than from “Front page:” select box, select the Home page. That sit.
How to add HTML code on WordPress home page
Second Method
If you want to add some different text or HTML code, than you need open functions.php file which you found in wordpress themes folders. Just copy and paste following code in that file.
We all are using the feedburner button in wordpress sites. In this article showing, How to fetch Feedburner Subscriber Count in wordpress website using our code.
How to fetch Feedburner Subscriber Count in wordpress
Just copy paste the following code in your sidebar.php file(This file you will find in your template folder.)
<?php
//You need to change the uri parameter to your website name
$whaturl=”http://api.feedburner.com/awareness/1.0/GetFeedData?uri=wordpressapi/ZoqV”;
//Initialize the Curl for using the feedburner api
$wordpressapi = curl_init();
//Set curl to return the data instead of printing it to the browser.
curl_setopt($wordpressapi, CURLOPT_RETURNTRANSFER, 1);
//Set the URL
curl_setopt($wordpressapi, CURLOPT_URL, $whaturl);
//fetching data
$data = curl_exec($wordpressapi);
//Closing connection
curl_close($wordpressapi);
$xml = new SimpleXMLElement($data);
$fbcount = $xml->feed->entry[‘circulation’];
echo $fbcount;
//end get cool feedburner count
?>
Echo $fbcount will print the feed Subscriber count.