飞龙博客

深入经藏 智慧如海

wordpress print custom fields or include custom fields to print

feilong.org 修订于2010-07-01 11:46:19 766

If you want to print special custom fields of a post or page when using wordpress 2.9.2 or wordpress3.0, feilong suggests you this solution in this post,The modified url is http://feilong.org/wordpress-print-custom-fields Go ahead.

Firstly,how to print wordpress contents or comments

1.download the latest wp-print plugin by lesterchan
http://lesterchan.net/wordpress/readme/wp-relativedate.html

2.install and activate the wp-print plugin in your wordpress blog admin

3.inset in the loop of your wordpress theme the template tags below:
<?php if(function_exists('wp_print')) { print_link(); } ?>

Secondly,how to print wordpress custom filelds

4.open wp-content/plugins/wp-print/print-posts.php with editplus or notepad.

5.search print_content(); and paste codes behind it in the <?php ?> tag.
_e('<h3>Feiloong Prints Custom Field weather</h3>');
//thanks to forums.lesterchan.net/index.php/topic,1377.20.html
global $post;
$key="weather";$postid = get_the_id();
$printweather = get_post_meta($postid, $key, true);
echo $printweather;

Enjoy!

Thanks to share it to others or track the newest content.

更新网址:http://feilong.org/wordpress-print-custom-fields
最初发布:20100701 11:44:03 feilong.org 于广州

加入收藏夹,查看更方便。

所在分类: wordpress

新作:

旧文:

飞龙前端QQ群