WordPress theme, Minimal Xpert Japanese version

My favorite WordPress theme lately is:Minimal Xpert There is something like that. Cimbalom World Association I was using it on a website, but there were some issues with it, such as excerpts not working properly in Japanese, so I was hesitant to use it on my own website. I took some time today to fix it, so I'll post the installation record as a memo.

First, install and configure as normal:

  1. Minimal XpertMinimal XpertDownload it from the site and extract it to /wp-content/themes/.
  2. Enable Minimal Xpert in Dashboard > Appearance > Themes (/wp-admin/themes.php).
  3. Configure the widget.
  4. Set up the menu. (By the way, this menu refers to the menu bar that appears directly under the site title.) Add a menu called "Menu" and add appropriate items from the left pane. Then, select "Menu" in the "Main Nav" pull-down menu under "Theme Location".
  5. "Slides" appears above "Appearance", so add Slides there. Add images as "Featured Images". The slide titles you set here will be used as captions for the actual slides.
  6. There is a menu called "MX Settings" at the bottom of the left menu, so open it and set it appropriately. Slide transitions will not be reflected unless you set them here once and then click "Save Options."

In English, this would be the end of it, but if it's left like this, the automatic summarization of the top page and other pages won't work properly. In English, it will extract the first 50 words and display "Read More..." for anything beyond that, but in Japanese, it will drag on and, at worst, display the entire text. This is because it distinguishes "words" by separating them with "spaces." In Japanese, this could result in 50 paragraphs.

Now, the file that extracts this is minimal-xpert/functions/better-excerpts.php. We will modify this file.

First, in line 11, the sentence is split into words with ' ', and in line 12, the number of words is counted, but this is meaningless for Japanese. It should be done based on the number of characters, so comment this out and get the total number of characters by $tot = strlen($text).

Furthermore, in line 14, the output "$output" is created by doing a for loop $words times, but this is meaningless, so comment it out. Instead, think of $words as the number of characters and create it by doing mb_substr($text,0,$words).

Below is the diff result.

11,12c11,13 < $text = explode(' ', $text); < $tot = count($text); --- > // $text = explode(' ', $text); > // $ tot = count($text); > $tot = strlen($text); 14c15,16 < for ( $i=0; $i<$words; $i++ ) : $output .= $text[$i] ' '; endfor; --- > // for ( $i=0; $i<$words; $i++ ) : $output .= $text[$i] . ' '; endfor; > $output.= mb_substr($text,0,$words);

Furthermore, edit minimal-xpert/post-entry.php. In the case of English, it was cut off at 50 words, but in Japanese, it will be 140 characters. There are two corrections. Below is the result of diff.

13c13 < ---> 50c140 < .---> .

That's it.

 



			
					

Leave a comment

This site uses Akismet to reduce spam.For details of how to process comment data, please click here.