Make an author box in WordPress

March 31, 2010

In this tutorial you will learn how to add the author’s profile box at the end of the wordpress post. If you have a gust authors it is good to have author’s profile box. You can easily change background, border colors by editing CSS code. Please make sure to backup theme before changing anything. Please add below CSS code in your style.css file which is located in your theme directory. #authorbox{ background:#EFEFEF; border:1px solid #CECFD0; width:638px; margin:0 auto; margin-bottom:10px; overflow:hidden; } #authorbox... [Read the full story]

Display list of wordpress pages in two columns

November 28, 2009

Usually in WordPress, the following code is used to call the pages list (you can find it in one of the sidebar files): <?php wp_list_pages(); ?> Normally when the list of pages is displayed in the sidebar or on any part of the theme, it displays in a single column. Through the following hack, you can split your pages list evenly into two or more columns which can save space and not make your pages longer. Now, we will try and split the pages into two columns. Simply paste the following code where you’d like your... [Read the full story]

Get tags related to wordpress category

October 13, 2009

Do you noticed there is no native way to retrieve tags based on the wordpress category. But if you want to be able to get tags related to one (or more) specific category, just insert the following function in your theme’s functions.php.   Here is the function you have to paste in your function.php file: function get_category_tags($args) { global $wpdb; $tags = $wpdb->get_results (" SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, null as tag_link FROM wp_posts as p1 LEFT JOIN wp_term_relationships... [Read the full story]

Get all wordpress custom fields from a page or a post

October 10, 2009

Sometimes you may need to get all custom fields from a specific post or page. How can we do that? Just paste the following functions on the functions.php files from your theme. Note: The function have lots of comments so it will help you to understand how it works. function all_my_customs($id = 0){ //if we want to run this function on a page of our choosing them the next section is skipped. //if not it grabs the ID of the current page and uses it from now on. if ($id == 0) : global $wp_query; ... [Read the full story]

Choose which wordpress sidebar to use

September 26, 2009

WordPress always have to display the same boring sidebar on each page? What can we do? Don’t worry, just create a few sidebar files, upload it to your wordpress theme directory. Then the code follow will do the rest. open single.php and find the call to the get_sidebar() function: <?php get_sidebar(); ?> Replace it by: <?php $sidebar = get_post_meta($post->ID, "sidebar", true); get_sidebar($sidebar); ?> Now when you’ll write a post, create a custom field name sidebar. As a value, give it the name... [Read the full story]