Archive for the ‘Wordpress knowledge base’ Category

While making a custom wordpress theme from static html, sometime we need to show shortcode within our template file for a image gallery or for some other plugin.
Wordpress provide a custom builtin funcion that parse the shortcode to required result.

Syntax: <?php do_shortcode(‘[your shorcode goes here]’); ?>

<?php echo do_shortcode(‘[shortcode id=id]’); ?>

You can use the same code withn the widgets, but in order to parse php within widgets you have to install a plugin like “Exec-PHP” to parse php.Then use text widget and write the same syntax written above to get the desired result.

WordPress Knowledge Base:

1. How to call a single post in wordpress template?

Wordpress function: get_post($post_id,$output);
$post_id = id of post to get content
$output = OBJECT- default an object
ARRAY_A-returns an associative array of filed names to values
ARRAY_N- returns numeric array of field values

Example 1:
$postId  = 1;
$data = get_post($postId);
$postTitle = $data->post_title;
$postContent = $data->post_content;

Example 2:
$postId  = 1;
$data = get_post($postId,ARRAY_A);
$postTitle = $data-[‘post_title’];
$postContent = $data[‘post_content’];

Returned Fields are:

ID (integer) The post ID
post_author (integer) The post author’s ID
post_date (string) The datetime of the post (YYYY-MM-DD HH:MM:SS)
post_date_gmt (string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content (string) The post’s contents
post_title (string) The post’s title
post_category (integer) The post category’s ID. Note that this will always be 0 (zero) from wordpress 2.1 onwards. To determine a post’s category or categories, use get_the_category().
post_excerpt (string) The post excerpt
post_status (string) The post status (publish|pending|draft|private|static|object|attachment|inherit|future|trash)
comment_status (string) The comment status (open|closed|registered_only)
ping_status (string) The pingback/trackback status (open|closed)
post_password (string) The post password
post_name (string) The post’s URL slug
to_ping (string) URLs to be pinged
pinged (string) URLs already pinged
post_modified (string) The last modified datetime of the post (YYYY-MM-DD HH:MM:SS)
post_modified_gmt (string) The last modified GMT datetime of the post (YYYY-MM-DD HH:MM:SS)
post_content_filtered (string)
post_parent (integer) The parent post’s ID (for attachments, etc)
guid (string) A link to the post. Note: One cannot rely upon the GUID to be the permalink (as it previously was in pre-2.5), Nor can you expect it to be a valid link to the post. It’s merely a unique identifier, which so happens to be a link to the post at present.
menu_order (integer)
post_type (string) (post|page|attachment)
post_mime_type (string) Mime Type (for attachments, etc)
comment_count (integer) Number of comments

Hi friends, In this post you will find a lot of wordpress tricky codes and functions that will help you for your wordpress rapid theme development.
I have collected wordpress useful stuff that will help beginners a lot. As all you know we need some resource to read from or if we can find some friend who can help.
I am here to help all my friends who want to be a wordpress theme developer. Here are some images that have much information for wordpress lovers. You can check and please send me your valuable feedback how can I improve this blog and if you have any question regarding wordpress theme development.

Hi friends, We usually search stuff for wordpress when we start a new wordpress project at that time we have lot of questions like

  1. how to make a theme and a sub theme.
  2. how to show posts from a single category.
  3. how to call a single post content or how to show single post from a specific category on home page etc.
  4. how to develop a best photo blog.
  5. how to setup facebook integration.

I have started this blog to help all such php developers who are new in this field and have a lot of questions how to start using wordpress.
Check this image this will help you a lot when you start making a new theme or child theme.