Show post titles at category, and show your own words at homepage.

<?php get_header(); ?> <?php if (is_home()) echo ” Welcome, add your own words here! “; ?> <?php if (!is_home()) { ?> <ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <a href=”<?php echo get_permalink()?>”><?php the_title(); ?></a> </li> <?php endwhile; endif; ?> <ul> <?php }  ?> <?php get_footer(); ?>

How to Get the Current Page URL

Sometimes, you might want to get the current page URL that is shown in the browser URL window. For example if you want to let your visitors submit a blog post to Digg you need to get that same exact URL. There are plenty of other reasons as well. Here is how you can do […]

How to let tag cloud show the same size font and in list style?

It is very easy to tag cloud show the same size font and in list style, there are 2 ways to do this: 1. Change sidebar.php in templates: <li> <h2>Tag Cloud</h2> <?php wp_tag_cloud(‘smallest=8&largest=8&number=45&orderby=name&format=list’); ?> <!– wp_tag_cloud(‘smallest=8&largest=8&number=45&orderby=name&format=list’)–> </li> another way is change code in widgets.php inside include document: function wp_widget_tag_cloud($args) { extract($args); $options = get_option(‘widget_tag_cloud’); $title […]

Code to display visitors IP address on website

get_ip_list below is a function that you must call in order to get something. function get_ip_list() { $tmp = array(); if (isset($_SERVER[‘HTTP_X_FORWARDED_FOR’]) && strpos($_SERVER[‘HTTP_X_FORWARDED_FOR’],’,’)) { $tmp += explode(‘,’,$_SERVER[‘HTTP_X_FORWARDED_FOR’]); } elseif (isset($_SERVER[‘HTTP_X_FORWARDED_FOR’])) { $tmp[] = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; } $tmp[] = $_SERVER[‘REMOTE_ADDR’]; return $tmp; } echo echo implode(“,”,get_ip_list());

Disordered Chinese Characters in Phpld

Open init.php, between $db->SetFetchMode(ADODB_FETCH_ASSOC); read_config($db); add MySQL_query(“SET NAMES ‘latin1′”); let them becomes:

Using php to control many domains withing one web host

can build many web sites, with one web host, one site with one different domain, just using php, it can make you very happy, save your money. $arrays=array( ’www.money.com’=>’money/index.html’, ’www.insurance.com’=>’insurance/index.html’, ’www.car.com’=>’car/index.html’, ’www.travel.com’=>’travel/index.html’, ’127.0.0.1’=>’forum/index.php’, ); $url = $arrays[$_SERVER[’HTTP_HOST’]]; Header(”Location: $url”); ?>