Archive for the ‘Wordpress Hacks and Tricks’ Category

Different single post template per category wordpress

Different single post template per category wordpress
If you want to display single post page using different single post template, then wordpress in_category() function will help to create different single post template. First thing you have to create different single post template like single_portfolio.php single_news.php single_wordpress.php single_default.php...

Wordpress get all subpages of current page’s parent page

Wordpress get all subpages of current page’s parent page
Following code will display all the subpages of same parent page. also displays the subpages of current page if it is not a subpage. <?php // Get Parent of current page.... $parents_id = $wpdb->get_row("SELECT post_parent FROM $wpdb->posts WHERE id = ".$post->ID." AND post_type...

Wordpress – File type does not meet security guidelines. Try another. Error

Wordpress – File type does not meet security guidelines. Try another. Error
This Error message comes when you are trying to upload image,music or video files which are not supported by wordpress. Wordpress have some whitelist of file types which are allowed to upload, Other files are not allowed to upload due to the security reasons. Accepted Filetypes Images .jpg .jpeg .png .gif For...

Wordpress Popular Post

Wordpress Popular Post
If you want to display most commented post or most popular post on your blog, you can display that using following code. Wordpress Popular Post or Most Commented Post without a Plugin <h2>Popular Posts</h2> <ul> <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title...

Wordpress Show title and excerpt of child pages on Parent page

Wordpress Show title and excerpt of child pages on Parent page
When you want to display all the child pages title and excerpt of current parent page then you can display by adding following code in your page template file <?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type...

Wordpress get Page content By Page ID

Wordpress get Page content By Page ID
Recently I am working on a wordpress project where I want to display short description from clients about us page in footer.. then i find this solution to display short description from the page content. We can limit the number of words displayed. Add following code in your functions.php file inside...