WordPress Ad Code Skills

Sometimes we want our ads codes show differently at our wordpress blog. Say we want to show adsense codes different types at different place, say homepage, single post. Simple!

The following code will show your ad code one at single post and single page, and ad code two at other places: Continue reading “WordPress Ad Code Skills”

Old domain to new domain – different accounts

We can use the following code, and paste them in .htacess file:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old-domain.com$
RewriteRule (.*)$ http://www.new-domain.com/$1 [R=301,L] Continue reading “Old domain to new domain – different accounts”

Category ID from current URL nicename and show some posts name

We can use the following code to get category ID from current URL nicename:
We can use the following code to get category ID from current URL nicename:
<?php
if(is_category() || is_single()){
 $category = end(get_the_category());
 $current =$category->cat_ID;
 $current_name = $category->cat_name;
}
echo $current_name . ” has id “.$current.” and is called “.$current_name;
;
?> Continue reading “Category ID from current URL nicename and show some posts name”

Show title at wordpress more tag

If we use the default wordpress more tag, then all posts will show a link with the word “more”, it is not so good for seo, because all the link words are the same: More, but they link to different pages with different content.

We can modify certain code to inforce wordpress “more” tag, we can add post title with more tag. There are two methods: Continue reading “Show title at wordpress more tag”

How to let non-www redirect to www domain?

Today I installed DEDECMS, a very popular PHP CMS open source system, I found I can not let non-www redirect to www domain. Say my domain is glassespeope.com, then I can not let http://glassespeople.com redirects to http://www.glassespeople.com. I tried to google, and found the following code can resovle the problems:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^glassespeople.com
RewriteRule (.*) http://www.glassespeople.com/$1 [R=301,L]

Save the above code in a .htaccess file, and upload this .htaccess to your web hosting root. Everything is OK!

How to use WordPress to design company site?

As we know that WordPress is very powerful, and Google likes it very much. If you can always publish quality contents for some months, I am sure Google will love your blog very much, and Google will index your new articles in minutes. That’s why more and more company come to use WordPress to design their business sites. Continue reading “How to use WordPress to design company site?”

How to Access MySQL Command Line in XAMPP?

MySQL binaries should be under your XAMPP folder. Look for a /bin folder, and you’ll find the mysql.exe client around. Let’s assume it is in e:\xampp\mysql\bin, then you should fireup a command prompt in this folder.

First, go to e:\xampp, and run xampp_start. If you do not run xampp_start first, the error message “Can’t connect to Mysql server on ‘localhost’” will occur when you go to step 2.

Afer you run the commend prompt of DOS, then enter:

cd d:\xampp\mysql\bin
mysql.exe -u root –password

Enter password:
and enter root password

mysql>

After log into your mysql server, and start typing your commands.
Type “quit”  or “exit” to exit mysql
Continue reading “How to Access MySQL Command Line in XAMPP?”

WordPress SEO

We should take care the following points on wordpress seo:
1. meta title:
We shoud let wordpress shows different titles for homepage, page, post, categories, very simple, replace the original title related code to

<title><?php wp_title(‘&laquo;’, true, ‘right’); ?> <?php bloginfo(‘name’); ?></title>

2. page title
Save as meta title, we can use the following code:
<h1><a href=”http://www.glassesexperts.com/”><?php if ( is_single() || is_page() || is_category() || is_tag() ) { wp_title(”); } else { bloginfo(‘name’); } ?></a></h1> Continue reading “WordPress SEO”

Some skills on showing wordpress posts

Sometimes we want to show wordpress posts according to our demanded styles. For example, we like to show 10 posts, and post links resource codes should like this:
<a title=”king php” href=http://www.kingphp.com>king php</a>
We can do as following:
<ul>
 <?php
 $rand_posts = get_posts(‘numberposts=10&orderby=rand’);
 foreach( $rand_posts as $post ) :
 ?>
    <li><a title=”<?php the_title(); ?>” href=”<?php the_permalink(); ?>”> <?php the_title(); ?></a></li>
 <?php endforeach; ?>
</ul>
</div> 
Continue reading “Some skills on showing wordpress posts”

How to let 2 domains show the same contents in Hostgator Hosting?

Sometimes we want to 2 domains show the same contents in Hostgator Web Hosting, and show different domain. For example, we want to let www.cheapglasses123.com, and www.bestpriceglasses.org show the same contents, but use differnt domains also. We can do like this when we Addon Domains to Hostgator Cpanel. Continue reading “How to let 2 domains show the same contents in Hostgator Hosting?”