WordPress Home and Category Pages How to Restrict Words in the Article Title

Several friends recently asked me how the home page and category page limit the number of words in the article title
I have put together the next issue, you can try
In the functions.php add the following code:

<?php

function excerpttitle($max_length) {
$title_str = get_the_title();
if (mb_strlen($title_str,’utf-8′) > $max_length ) {
$title_str = mb_substr($title_str,0,$max_length,’utf-8′).’ …’;
}
return $title_str;
}?>

This defines a function, how to call it
In the page you want to use the word limit will be original

<?php the_title(); ?>

Replace

<?php echo excerpttitle(23);?>

It will be OK

Original Theme WP Chinese: WP-CMS Installation and Debugging Process

First statement, this theme is alien to me, but according to my experience, follow the instructions to install the debugging, I will provide you a detailed installation and debugging tutorial.

Below to start the installation ^-^

1. Download a WordPress source http://CN.WordPress.org/, download the latest version of WordPress-3.0.1 installed I will not speak here, see Tutorial: five-minute installation of WordPress

2. Install theme, theme download: original theme WP Chinese: WP-CMS and reference this article: original theme WP Chinese: WP-CMS supplementary information

3. Construction classification section, which is based on your site to be established, I built 12 columns

4. Closing colun-2, file blank.jpg “behind the/> div, to make thumbnail in Home is not misplaced.

5. mainnav.php modified Home title, using DW tool to modify it on the line.

6. Install 3 important plugins: 1. Popularity Contest 2. WordPress Related Posts 3. WP-PostViews

7. In order to better debug the theme, put 5-10 articles in each section. This debugging can be more intuitive to show effects.

8. I am using GoDaddy Win host, does not support Chinese labels, so the WordPress files, modify methods as described in: WordPress Chinese label not connected properly-the perfect solution

9. Modify the counter, detailed method: Wp-PostViews method of installing counter

10. Change list page to modify the display article summaries, tag.php article summary changes, revisions, please see: WordPress articles several methods

11. Install WP-PageNavi page plugin settings page, set tutorial: best page in WordPress plugin

12. Highlight the title bar, modify the CSS style adjustments.

13. Modify the words in the article title, according to needs of the site, how to modify See detailed tutorial: WordPress home page and classification page how to limit the number of words in the article title

14. Adjust the ID number

Demo http://www.2319.info/demo stand to further revise and perfect. Have any suggestions please leave a message.

 

WordPress Related Posts Plugin: WordPress Related Posts

WordPress 2.3 version started WordPress built-in Tag support, because WordPress use MySQL database does not support the Chinese word segmentation, so in the Chinese case the best way to generate relevant logs is through the Tag, according to the log contains the same Tag number, Log more relevant, so I developed under this principle WordPress Related Posts this plug-in.

So the most basic function of WordPress Related Posts Plugin is based on log correlation tag produces a list of related posts and related posts list can be added to the Feed.

Installation and use:

Upload the whole plugin folder to the /WP-content/plugins/directory or install directly in the background
Activate the plugin under the Plugins menu
Insert the <? Php wp_related_posts ();?> Template function at the appropriate location in the template file or use the auto-insert-related logging feature in the background
In the management interface, Manage > Setting > configuration plugin Related Posts output

Detailed configuration

WordPress related posts plugin has more configuration options, explain the meaning of each option below.

WordPress Related Posts Plugin backend options

Relevant log list title: to the entire related log list the entire title, can be related Posts or related log can be.

Title tags: H2, H3, H4, p, div, or five choices, you choose your own theme, if the title of the associated log for Related Posts, select label for the H3, the last title in the HTML forms for <h3>Related Posts</h3>

Maximum Display: is to set the related posts display to a maximum of a few.

Exclude (category ID): If you do not display logs in certain categories, enter the IDs of these categories into this box, separated by a semicolon (,) in English

Other settings:

Displays the number of messages: the log shows how many messages in the log

Displaying the log publication log: Displays the log release date in the relevant log

Automatically inserts the relevant logs: If you do not want to manually insert a <?php wp_related_posts in single.php ();? > template function, this option can be inserted automatically.

Add related logs to RSS: Check this option if you want the log to appear at the end of the log in the feed.

Summary of settings: If you want to display related posts summaries of the log, you can achieve here, selection, will let you enter a summary up text.

No relevant log settings: When the articles related to a log of the log, what do you want to show? This plugin allows you to choose:

Simple shows no correlation log text
Random log
Up to message logs
The most popular log (if you install the Popularity Contest plugin)

You can also set their title or text after selecting the log categories that appear when there is no associated log.

Thumbnail settings: If your blog set a thumbnail for each log with a custom field, you can also display the log by thumbnails, this feature has two more settings:

And whether text such as a title is also displayed.
Select which custom fields are used to display thumbnails.

The thumbnail feature is for advanced users or users need to use, generally are not, so if you do not understand what this means, then please do not select. 🙂

 

Ranking Plugin Popularity Contest WordPress Articles Use Code Tutorial Beginner Advanced Strategy

See a lot of sites have monthly article ranking, number of days article ranking. How to achieve it? It is achieved by the Popularity Contest plug-in. We come to find out about it.

Popularity Contest is currently the latest version 2.0b2, you can download here: http://downloads.WordPress.org/plugin/popularity-contest.2.0b2.zip

Installation method

Address in the zip package downloaded above and extract to a directory.
Upload the popularity-contest.php file in the directory WP-content/plugins directory of WP, all plugins should be placed into this directory.

Page display method

Popularity Contest supports Widget, Once you have enabled the Popularity Contest, you can set the Widget in the appearance of small tools.

Widget options

Widget Title: is the header you want to display in the right side of the header.

Report Type: The type of display. As the Last 90 Days, meaning the last 90 days ranks; By Category, are displayed by category ranking; Last (n) Days, meaning that ranked the last n days, the value of n is the Number of days.
There are many types, we can try one by one.

Numbers of posts t0 display: shows how many.

Exclude pages: exclude pages, page refers to the custom page in WordPress, such as about us.

Popularity Contest settings

You can go to-Popularity settings menu to set the Popularity Contest.
Popularity Contest have some setup options, these options are public, which would affect all of the Widget (Widget option was only for a single Widget).

General settings

General setting has four options, the fourth is not much use, we can not ignore it.

Ignore views by site authors: whether to ignore the site author, if you select Yes, then the site authors clicks will not count.

Show popularity rank for posts: articles page shows the sentiment of the article, is usually above or below the article to display.

Show the [?] help link: displayed when the article has the popularity, whether to display [?] Connections, and used the last option.

Popularity value settings

Popularity Contest calculates the popularity of an article through a variety of values, including the number of hits in the article, the number of articles in the article, and so on.

A comment (Comments) can be increased to 20 popular article, click on the article once (Permalink Views) can be increased by 10, you can adjust according to their needs. I did not move anything, according to the default.

Background statistics

Popularity Contest is a comprehensive statistics page, you can control panel-Most Popular Posts to see. Here are some statistical picture.

Popularity Contest template tags

akpc_the_popularity()

Put this tag in the Loop cycle, you can display the article’s popularity. Popularity value is a percentage that is relative to your most popular posts. For example, you work out the most popular articles of value is 1000, while the other article’s value is 500, then another article’s popularity value is 50%.

Code example:

<?php if (function_exists(‘akpc_the_popularity’)) { akpc_the_popularity(); } ?>
akpc_most_popular($limit = 10, $before =
, $after =
)

Put this tag on the outside of the Loop cycle, you can display a list of the most popular articles, three parameters are optional, and if not set, its default value will be used.

<?php if (function_exists(‘akpc_most_popular’)) { akpc_most_popular(); } ?>

<?php if (function_exists(‘akpc_most_popular’)) { ?>
Most Popular Posts
<?php akpc_most_popular(); ?>
<?php } ?>
akpc_most_popular_in_cat($limit = 10, $before =
, $after =
, $cat_ID = current category)

Put this tag on the outside of the Loop cycle, you can display a list of most popular articles under a particular category.

<?php if (function_exists(‘akpc_most_popular_in_cat’)) { akpc_most_popular_in_cat(); } ?><?php if (is_category() && function_exists(‘akpc_most_popular_in_cat’)) { akpc_most_popular_in_cat(); } ?>< ?php if (is_category() && function_exists(‘akpc_most_popular_in_cat’)) { ?>
Most Popular in ‘<?php single_cat_title(); ?>’
<?php akpc_most_popular_in_cat(); ?>
<?php } ?>
akpc_most_popular_in_month($limit, $before, $after, $m = YYYYMM)

Put this tag on the outside of the Loop cycle, you can display a list of most popular articles in a specific month.

<?php if (function_exists(‘akpc_most_popular_in_month’)) { akpc_most_popular_in_month(); } ?><?php if (is_archive() && is_month() && function_exists(‘akpc_most_popular_in_ month’)) { akpc_most_popular_in_month(); } ?><?php if (is_archive() && is_month() && function_exists(‘akpc_most_popular_in_month’)) { ?>
Most Popular in <?php the_time(‘F, Y’); ?>
<?php akpc_most_popular_in_month(); ?>
<?php } ?>
akpc_most_popular_in_last_days($limit, $before, $after, $days = 45)

Put this tag on the outside of the Loop cycle, you can display a list of most popular articles in recent days.

<?php if (function_exists(‘akpc_most_popular_in_last_days’)) { akpc_most_popular_in_last_days(); } ?><?php if (function_exists(‘akpc_most_popular_in_last_days’)) { ?>
Recent Popular Posts
<?php akpc_most_popular_in_last_days(); ?>
<?php } ?>

Summary

Popularity Contest is a very comprehensive article ranking statistics plugin, it is very simple to install and use, the program is stable, it is also very flexible, based on the need to configure any type of list that you want, and with it, your right column will become simple and rich.

WordPress Chinese Tags Can Not Connect Properly – The Perfect Solution

WordPress Chinese label not connected properly-the perfect solution
WordPress Chinese label link does not open (error 404 – File not found) solutions

For example, click on the Chinese label appears the article can not find the page, found a bit on the Internet probably has several solutions, I recommend the first.

Modify WP-includes/rewrite.php

This is the most common online method, principle is that other content when using the Permalink, WordPress, not used to tag, and use the QueryString link 2 send Chinese encoding mode:

function get_tag_permastruct() {
if (isset($this->tag_structure)) {
return $this->tag_structure;
}
if (empty($this->permalink_structure)) { //—–this line need change–
$this->tag_structure = ”;
return false;
}

The 5th line to

if (!empty($this->permalink_structure)) {

If you are using the windows host, you can also do the following:

Principle is that IIS will UTF-8 into GBK PathInfo, QueryString does not convert, so in order to use the Permalink, use the following methods:

Open the WP-includes/classes.php file,

if ( isset($_SERVER[‘PATH_INFO’]) )
$pathinfo = $_SERVER[‘PATH_INFO’];
else
$pathinfo = ”;
$pathinfo_array = explode(‘?’, $pathinfo);
$pathinfo = str_replace(“%”, “%25”, $pathinfo_array[0]);
$req_uri = $_SERVER[‘REQUEST_URI’];

Changed to

if ( isset($_SERVER[‘PATH_INFO’]) )
$pathinfo = mb_convert_encoding($_SERVER[‘PATH_INFO’], “UTF-8”, “GBK”);
else
$pathinfo = ”;
$pathinfo_array = explode(‘?’, $pathinfo);
$pathinfo = str_replace(“%”, “%25”, $pathinfo_array[0]);
$req_uri = mb_convert_encoding($_SERVER[‘REQUEST_URI’], “UTF-8”, “GBK”);

The disadvantages of this issues are: for Windows host only, and must be under Windows IIS hosting works.

The last method is to modify the tag base

Principle as above, as long as WordPress open Permalink function to continue to ignore the tag on the list. So, deceive WordPress, it is used to link 2 format to show Permalink, feasible? Feasible, because WordPress can customize the form of Permalink:

In WordPress (settings) Settings – (Permalink) Permalinks – (tag prefix) in Tag base insert

/?tag=

Note “\” can not be less, quoted in the original wording wrong. Also note that each time you enter “\”, WP will once again escaped as “\”, so each point will be submitted to the “” double “, twice is the” \ \ “, so do not multipoint

The result of this method is to make the links look like
www.example.com/?tag=/Chinese/

The extra slash has no effect on the server, or is considered QueryString, the same effect.

The limitation is that links become more difficult to read, more deadly is the plug-in generated Sitemap, tag link will become the wrong form, if you care about Sitemap, please do not use this method unless you really own rewrite.php file cannot be modified.

But when you use WP-SuperCache or similar cache plugin, it will add their own rewrite rules, all requests their own judgment, is not in the cache or not to cache rules before handing over to WordPress. But the problem is that it does not support URL parsing, not even a QueryString. So we have to bypass it.

This is WP-SuperCache in the .htaccess file in the add a rewrite rule

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*p=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{QUERY_STRING} !.*wp-subscription-manager=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]

RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} !.*s=.*
RewriteCond %{QUERY_STRING} !.*p=.*
RewriteCond %{QUERY_STRING} !.*wp-subscription-manager=.*
RewriteCond %{QUERY_STRING} !.*attachment_id=.*
RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f
RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
我们要做的就是不让它去判断中文tag链接,在两个 RewriteCond %{REQUEST_METHOD} !=POST 后面分别加入这样一句:

RewriteCond %{QUERY_STRING} !.*tag=.*

The implication is that if QueryString contains tag words, please do not parse (to the next rule, generally speaking is WordPress index.php).

Conclusion:
Under the Windows+IIS host, through the programme and can be the perfect solution on the tag in Chinese

Under the Linux + Apache mainframe, the Chinese can not use Permalink, unless the revised Apache, or only one of the three options and program.

Option 1 is the recommended method, but when used with WP-SuperCache, you need to add a rule in your .htaccess file that does not handle tag links.

How to Install WP-PostViews Counters

Always wanted to have a counter to see how your WordPress visits.

Search online for a long time and found that WP-PostViews is so famous and, therefore, as follows:

  1. Download WP-PostViews
  2. Extract, upload plug-in to the wp-content / plugins directory
  3. Find WP-PostViews plugin in the background, enabled.
  4. In the “settings” click on “PostViews” option, there are three options, is the most simple English, does not understand the dictionary or Google, so tired of typing.
    And then very happy to go Home page for a long time, has not found where there are statistics, people search, finally found the original template’s index page or pages you want to add a Word, TNND, why are all the plugins we have introduced this detail are not talking, I thought that enabling the plugin will automatically add comments below the article number.
  5. So you can manage-> look-> theme editor->index.php, in your comments (that is, which of the comments), which prior to that angle brackets, insert the following statement. (Reminder, many websites and blog will be modified to fulfill single quotation marks to single quotation marks, I like this blog has this problem, and after copying check! )
    <?php if(function_exists(‘the_views’)) { the_views(‘views’, true); } ?>

And found the effects are as follows
8 Views Comment (0)
———————-

Feel very unhappy, why number of views not behind like a comment and put it in parenthesis? Change for a long time, and followed by a small vertical lines, the effect is as follows
Views (8) | Comment (0)

Method is to just change that sentence
Views (<?php if(function_exists(‘the_views’)) { the_views(“, true); } ?>) |

You’re done! Go to http://nwgale.com/blog look at the results bar.

Of course you can edit
Number of views (<?php if (function_exists (‘the_views’)) {the_views (“, true);}? >) |

But the final frustration found that the counter is not allowed to show a large amount of access to a bit ridiculous, and the background of FireStats a little bit fake, no way, first put it.

Original Theme WP Chinese: WP-CMS Supplementary Information

WP Chinese original theme: WP-CMS supplementary note

This theme in use in addition to a large number of links you need to manually modify the code, the main issue focused on the following points:
  1. How the content is displayed in the colun1-colun2-colun3-colun4 module?
  2. How do I modify the display colun1-colun2-colun3-colun4 display classification and quantity
  3. Thumbnails and how to display the first slide
  4. colun-2 file, blank.jpg “/> div is not closed so there is no thumbnail in the first page of the dislocation of the
  5. Why does this theme page appear incorrect? Which need to install several plug-ins
Answered to these questions below:
  1. Colun1 -colun2 -colun3-colun4 acquiescence is not displayed in the background appearance -> under the current theme of the option to display the selected section can be displayed
  2. Module colun1-colun2-colun3-colun4 corresponding to topics in four files in the templates folder in the package, the same name. Can be found in the background look-> edit to modify
  3. Home thumbnail and slide show pictures are by published an article under the custom columns to add,
    As long as when you made the article, add a custom section to fill in the name of “pre_image”
    Fill in the value of the picture you can fill in the remote URL address, the same name in the slide thumbnail to fill in the name
    The effect of this example can refer to Demo
  4. On the picture is not displayed, you first need to close the div as images / blank.jpg “/> complete, the remaining dislocation does not need to modify, add the thumbnail automatically aligned
  5. Plug-in is the most important, several plugins needed:

1.Popularity Contest 2. WordPress Related Posts 3.WP-PostViews

Specific configuration does not repeat, do not understand you can contact me through the blog.

Other, and finish loading the plug-in if there is a dislocation in a related article, please fix the style.CSS (images/Top10.gif) pixel after 26px;

Functions.php Google AD in it! (014782006753236413342:1ltfrybsbz4) as the original author of advertising ID! You can replace;

There are many details to modify the archive.php, you modify the code out unnecessary and pictures;

In addition: on category ID get complemented by convenient for novices and children’s shoes

Category ID when you put your mouse over the category name on the browser window displays the address

Behind the figures behind cat= is the category ID is simple!

 

WP Chinese Original Theme: WP-CMS


Author: zqjilove
Language: Chinese
Category: CMS
Version: 1.0 beat
Presentation: this blog will be debugging and debugging process article, for your reference, please look … …

Theme Profile: Another very beautiful people of the original WordPress magazine theme, the theme mimics the style of the DEDE’s official website.

Note: this theme is very beautiful, but unfortunately, the author shares have been described, this template is a semi-finished product, really want to use, need to change place a lot …

WP-CMS theme instructions:

Four plate marked in the figure below: colun1-colun2-colun3-colun4 corresponding to four files in the templates folder in the theme package, same name.

Category calls modify method: to colun1 example: search showposts

Home template file description:

You may ask how to use the article thumbnail, in fact, very convenient, as long as you are in the article at the time, find the following Custom File, and then fill in the Key “pre_image”, fill in the Value of your image address, as follows:

Similarly a slide show of pictures the calling method is: fill Key “thumbnail” can be.

WP Chinese original theme: WP-CMS supplementary note

 

Several Methods of WordPress Article Summarization

Today to talk about WordPress article abstract methods
  1. The most commonly used one is <! – more – > labels to realize article summary function, write articles in places where you need to insert the <! – more – > tag to truncate the article
  2. Use the_excerpt tag, you need to modify the archive.php and index.php file and find <?php the_content ();? >
    <?php if(!is_single()) {
    the_excerpt();
    } else {
    the_content(__(‘(more…)’));/ /Or <?php the_content ();? >
    } ?>
  3. WordPress article summary Advanced Edition, based on the need to control the length of the text, 200 is 200 characters in the code, modify the <?php the_content in index.php, archive.php file ();? >, turn him into

<?php echo mb_strimwidth(strip_tags(apply_filters(‘the_content’, $post->post_content)), 0, 200,”…”); ?>

WordPress theme: iNews-v2 Installation and Debugging Process

Because I think this theme is good, so I love WP to install and debug the WP, decided to see how effect:

1. Download a wordpress source, http://cn.wordpress.org/, I downloaded the latest WordPress -3.0.1 Chinese version, the installation here I will not speak, see my previous tutorial: five-minute quick installation WordPress

2. After you installed the program, the installation of the theme, and then add 12 columns in the background, and are with the article.

To lose weight network as an example: with 12 columns. Weight loss, diet recipes, weight loss tips, weight loss exercise, yoga to lose weight, celebrity weight loss, face weight, skinny weight, skinny hips weight, thin waist slimming thin abdominal weight, thin arms on weight loss with 12 columns, here is my add in, you don’t have to care about, mainly the debugging process. And well, then put 5-10 articles in each section.

To lose weight network as an example: with 12 columns. Weight loss, slimming weight loss, slimming weight loss, thin waist weight loss, thin abdominal weight loss, thin arm weight loss plus 12 columns, here is my weight loss, weight loss, weight loss tips, weight loss tips, weight loss tips Free to add, we do not have to care about, mainly debugging the program. And well, then put 5-10 articles in each section.
3. the following is to modify the template of the site:

(1) multiple languages at the top of the navigation bar
(2) Home slideshow picture transformation
(3) the Home called the 12 categories
These WordPress themes: iNews-v2 has detailed instructions, I will not say anymore.

4. modify column calls cannot display problems, specific changes to methods, please refer to:
Theme iNews-v2 in WP 3.0 cannot call the category names cause and solving method

At this point, the blog has largely been completed, simple. Have any questions please leave a message and I’ll try to answer.

Demo: http://jianfei.52wordpress.NET/