Add one adsens ads except homepage.

It is very simple, copy the following code, and change YOU ADSENSE ADS CODE HERE. to your ads code. done!

 <div class=”storycontent”>

<?php if (($wp_query->current_post == 0)and (!is_home())) : ?>
<div style=”float:right”><br>
YOU ADSENSE ADS CODE HERE.
</div>
<?php endif; $postcnt++; ?>
  <?php the_content(__(’(more KINGPHP details…)’)); ?>
 </div>

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 that. Read the rest of this entry »

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 = empty($options[’title’]) ? __(’Tags’) : apply_filters(’widget_title’, $options[’title’]);

 echo $before_widget;
 echo $before_title . $title . $after_title;
 wp_tag_cloud(”); //wp_tag_cloud(’smallest=8&largest=8&number=45&orderby=name&format=list’);
 echo $after_widget;
}

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());

Add php code into html for lunarpage.com

Add php code into html for lunarpage.com linux host.

try this line in a blank .htaccess

AddType application/x-httpd-php php html

Add php code into html for php5

AddType application/x-httpd-php5 .html .htm .php
AddHandler application/x-httpd-php5 .html .htm .php

how to deal with a sentence as a page title?

<?php
$hotel=”  How to study PHP  “;
$hotel= trim($hotel);
$array=explode(” “, $hotel);

$hotel=implode(”-”, $array);
echo ($hotel);
?>

Php test Navigation engine laguage, and Syetem language

Php test Navigation engine laguage

Php test Syetem lang

Read the rest of this entry »

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: Read the rest of this entry »

12»