Returns template directory URL to the active theme.
Example
bloginfo(‘description’);
Note that directory URLs are missing trailing slashes.
admin_email = admin@example
atom_url = http://example/home/feed/atom
charset = UTF-8
comments_atom_url = http://example/home/comments/feed/atom
comments_rss2_url = http://example/home/comments/feed
description = Just another WordPress blog
home = http://example/home
html_type = text/html
language = en-US
name = Testpilot
pingback_url = http://example/home/wp/xmlrpc.php
rdf_url = http://example/home/feed/rdf
rss2_url = http://example/home/feed
rss_url = http://example/home/feed/rss
siteurl = http://example/home
stylesheet_directory = http://example/home/wp/wp-content/themes/largo
stylesheet_url = http://example/home/wp/wp-content/themes/largo/style.css
template_directory = http://example/home/wp/wp-content/themes/largo
template_url = http://example/home/wp/wp-content/themes/largo
text_direction = ltr
url = http://example/home
version = 2.7
wpurl = http://example/home/wp
Example
bloginfo(‘description’)
Here is a way to retrieve a number of posts in a specific category in wordpress.
global $post;
$myposts = get_posts('numberposts=5&offset=1&category=1');
foreach($myposts as $post) {
setup_postdata($post);
echo the_title();
}
Here is how you can get a summary of number of posts in your wordpress blog. The returned value is an object array containing the total number for published, draft and pending posts in your blog.
$count_posts = wp_count_posts();
Get the number of published posts
echo $count_posts->publish;
Here is a code snippet for getting WordPress post title and content using script. Example uses post ID.
$my_id = 7;
$post_id_7 = get_post($my_id);
$title = $post_id_7->post_title;
$content = $title = $post_id_7->post_content;
NOTE:
You must ONLY pass the variable containing an integer value and not the actual integer. The function receives value by reference.
$post_id is an array object:
Learn more here
here is how you can easily add favicon to your wordpress blog/websire:
1) Ofcourse, you need the image (usually favicon.ico)
2) Add the following code between header tags in your theme’s header.php
<link rel="shortcut icon" href=”faviconpath” />
If your wordpress installation can’t write the mod_rewites rules to your .htaccess file, there are two ways to solve that problem.
1] Navigate to your .htaccess file (/opt/lampp/htdocs NOTE: you may want to view > hidden files)
2] Copy the rules and paste at the bottom of the file.
3] SAve and restart your apache server.
OR
You can simply increase the security level, if thats just the development environment, which probably it is (lampp!)
Regards
If you want to get a list of all your page’s title, ID and Link as an array object here is a little snappy script to do just that.
$pages = get_pages('sort_column=menu_order');
foreach ($pages as $parr)
{ $option=get_page_link($parr->ID).' <-> '
.$parr->ID.' <-> '
.$parr->post_title;echo $option;
}
To get all top level pages as an array object:
$pages=get_pages('sort_column=menu_order&parent=0');
More info about the arguments and the function itself: click here
Enjoy!
Here is a nice little script to quickly install wordpress using Shell Script:
Enjoy
#!/bin/bash
wget http://wordpress.org/latest.zip
unzip latest.zip
cp -rf ./wordpress/* ./
Installing:
– Start browser and type path to your wordpress extraction folder:
– Follow instructions:
– create database and assign users.
– configure the wp-config.php file with given script (if wordpress cant do it itself)
– Install and continue with instructions.