使用 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 繼續閱讀的相關問題

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

閱讀更多

CSS製作滑鼠移動到圖片上圖片會放大的效果

CSS製作滑鼠移動到圖片上圖片會放大的效果

CSS製作滑鼠移動到圖片上圖片會放大的效果

近期發現很多自架的部落格網站,當滑鼠移動到文章的特色圖片時會有圖片放大的效果

要怎麼做到呢?以下是範例參考:

閱讀更多

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

Responsive Email Design 響應式郵件設計

Responsive Email Design 響應式郵件設計

Responsive Email Design 響應式郵件設計
現在人用手機來收信的機會愈來愈高,所以為了適應行動裝置各種大小,郵件設計師必須添加判斷式於郵件內容中。

@media only screen and (max-width: 600px){ ... }

判斷寬度小於600px時,套用這段CSS屬性
閱讀更多