標籤存檔: WordPress

使用 Poedit 翻譯 WordPress佈景主題、外掛

使用 Poedit 翻譯 WordPress佈景主題、外掛

使用 Poedit 翻譯 WordPress佈景主題、外掛

某些貼心的WordPress主題、外掛(通常是付費),都會提供語系po檔

若找不到zh-TW.po語系,這時我們就可以用Poedit來自己翻譯

並存成zh-TW.po檔,放到原本的資料夾中

網頁上面對應的英文字就會變成中文囉^^

 

未來當主題或外掛po檔有更新時,要怎麼把新的原文內容加到你已翻譯好的主題或外掛po檔呢?

1.先開啟您之前翻譯的po檔

2.專案(項目檔)>從POT檔更新>選擇新的po檔>確定匯入

3.進行新的原文內容翻譯>儲存>上傳

多語系網頁宣告其他語系版本

例如在你的繁體版本網頁中宣告簡體版本的網址,可在head標籤內加入

<link rel="alternate" href="https://yourname.com/zhcn/" hreflang="zh-CN" />

WordPress 繼續閱讀的相關問題

WordPress 繼續閱讀的相關問題

有些佈景會遇到繼續閱讀變成[...]或是沒有顯示繼續閱讀的問題,可參考以下方式解決

閱讀更多

無名小站 掰掰

無名小站 掰掰

在2004/07/26號這天,多力哥加入了無名
開啟了寫部落格的新頁

閱讀更多

Apache 網站頻寬限制

Apache 網站頻寬限制

限制每個站台的頻寬,編輯httpd.conf

LoadModule ratelimit_module modules/mod_ratelimit.so

閱讀更多

WordPress 抓取文章第一張圖片顯示在首頁

WordPress 某些主題在首頁只會顯示"特色圖片",你可以用以下兩種方式直接顯示文章的第一張照片

方式1
//抓取文章第一張圖片
function catch_that_image() {
global $post, $posts;
$first_img = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
$first_img = $matches [1] [0];

if(empty($first_img)){ //Defines a default image
$first_img = "/images/default.jpg";
}
return $first_img;
}

<p><img src="<?php echo catch_that_image() ?>"></p><!-- 顯示第一張圖片 -->

方式2:
複製下面的代碼到 functions.php 中

//Automatically Set the Featured Image in WordPress
function autoset_featured() {
global $post;
$already_has_thumb = has_post_thumbnail($post->ID);
if (!$already_has_thumb)  {
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
if ($attached_image) {
foreach ($attached_image as $attachment_id => $attachment) {
set_post_thumbnail($post->ID, $attachment_id);
}
}
}
}  //end function
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');

WordPress 添加自定義代碼

修改functions.php檔

加入:
function get_word($atts) {return 'Hello I am Dorigo';}
add_shortcode('hello', 'get_word');

之後在文章中輸入[hello]

就會顯示Hello I am Dorigo

可以用在廣告代碼顯示^^

XAMPP 安裝設定說明筆記(windows)

XAMPP 安裝設定說明筆記(windows)

XAMPP是完全免費且易於安裝的Apache發行版本,其中包含MySQL、PHP和Perl。XAMPP開放源碼套件的設置讓安裝和使用出奇容易。

XAMPP Apache + MySQL + PHP + Perl

下載安裝檔:https://www.apachefriends.org/zh_tw/download.html

Windows 2008, 2012, Vista, 7, 8 (Important: XP or 2003 not supported)

閱讀更多