Genesis Simple Hooks

外掛說明

這個外掛會產生新的 Genesis 設定頁面,讓網站管理員能夠插入程式碼片段 (如 HTML、短代碼及 PHP),並將這些程式碼片段附加至超過 50 個由 StudioPress Genesis Theme Framework 提供的動作勾點。

與其在佈景主題檔案中經歷繁瑣又複雜的函式建立流程,這個外掛提供美觀易用、透過勾點系統修改 Genesis 佈景主題的使用者介面,並且接受使用者透過 HTML、短代碼及 PHP 存取 Genesis 佈景主題超過 50 種內建勾點以及數個 WordPress 內建的勾點。。

程式碼片段

Genesis 使用者最常提出的要求,便是想正確修改網站頁尾、文章資訊及文章中繼資料文字。這裡提供對這些要求有所幫助的程式碼片段:

修改文章資訊

<div class="post-info">
    <span class="time"><?php the_time('F j, Y'); ?></span> <span class="author">by <?php the_author_posts_link(); ?></span> <span class="post-comments"><a href="<?php the_permalink(); ?>#respond"><?php comments_number('Leave a Comment', '1 Comment', '% Comments'); ?></a></span> <a class="post-edit-link"><?php edit_post_link('(Edit)', '', ''); ?></a>
</div>

修改文章中繼資料

<div class="post-meta">
    <span class="categories">Filed under: <?php the_category(', ') ?></span>  <span class="tags">Tagged with <?php the_tags('') ?></span>
</div>

修改網站頁尾

<div class="gototop">
    <p><a href="#wrap" rel="nofollow">Return to top of page</a></p>
</div>
<div class="creds">
    <p>Copyright &copy; <?php echo date('Y'); ?> &middot; <a href="http://www.studiopress.com/themes/genesis" title="Genesis Theme Framework">Genesis Theme Framework</a> by <a href="http://www.studiopress.com/">StudioPress</a> &middot; <a href="https://wordpress.org/" title="WordPress">WordPress</a> &middot; <?php wp_loginout(); ?></p>
</div>

注意事項:如果要使用範本標籤,則必須啟用 [在這個勾點中執行 PHP 程式碼]

安裝方式

  1. 將外掛安裝套件 ZIP 壓縮檔解壓縮所得的 genesis-simple-hooks 資料夾上傳至網站的 /wp-content/plugins/ 目錄中。
  2. 請勿重新命名 genesis-simple-hooks 資料夾。
  3. 在 WordPress 管理後台的 [外掛] 選單中啟用外掛。
  4. 找到想要使用的勾點 (這些勾點已分組)。
  5. 在想要使用的勾點中新增要執行的程式碼。
  6. 設定是否要在勾點中執行短代碼或 PHP 程式碼。
  7. 儲存設定,大功告成。

常見問題集

短代碼是什麼?

請查看官方的 Shortcodes API 線上說明。

PHP 程式碼片段無法執行。

請確認已啟用 [在這個勾點中執行 PHP 程式碼]。

如果已啟用必要選項,請務必將全部 PHP 程式碼包裝於 <?php ?> 標籤中,系統就是透過這種方式辨識要執行的 PHP 程式碼。

外掛無法啟用。

網站必須先安裝並啟用 Genesis 或其子佈景主題。

使用者評論

2020 年 4 月 14 日
I’m really disappointed to find out that this plugin is not compatible with my recipe plugin which is a huge problem since I write a food blog. Now, all of my recipes appear twice. It’s the same with my social media buttons. This plugin was extraordinarily helpful in creating a second menu that I actually liked the look of. But now, it’s messed up things that are essential.
2016 年 12 月 6 日
Love this plugin, allows ease of use in footers, headers and anywhere else I need it. Make my Genesis site work the way I thought it should. [link removed]
閱讀全部 22 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Genesis Simple Hooks〉的開發相關工作。

參與者

〈Genesis Simple Hooks〉外掛目前已有 4 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Genesis Simple Hooks〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

2.3.2

  • Fix “translation loading triggered too early” warning.
  • Fix “plugin does not have a valid header” during activation due to duplicate plugin header.

2.3.1

  • Genesis Simple Hooks now uses its own update mechanism from WP Engine servers. (Not released to WP.org.)

2.3.0

  • Reorganize plugin based on our standard boilerplate.
  • Update to match WordPress PHP standards.
  • Fix bug where plugin name was empty in the minimum version warning.
  • Increase minimum Genesis version to 2.5.0.

2.2.1

  • Genesis 2.6+ compatibility (prevents white screen).
  • Remove reference to deprecated function.

2.2.0

  • Rewrite plugin based on new plugin boilerplate.
  • Added new hooks.
  • Require unfiltered_html capability to execute PHP.
  • Better Genesis dependency handling.
  • Change activation hook to conditional admin notice.
  • Allow hooks to be de-registered via filter.

2.1.2

  • Load textdomain
  • Add plugin header i18n

2.1.1

  • Generate POT file.

2.1.0

  • Increased requirement to Genesis 2.1.0.
  • Site title and description hooks.
  • Fixed outdated hook descriptions.

2.0.1

  • Genesis 2.0 favicon unhook location fix.

2.0.0

  • Updated to use new entry hooks in Genesis 2.0.
  • Remove unused boxes.php file.

1.8.0.2

  • Fixed yet another fatal error but for people using less than Genesis 1.8.0. It should now deactivate gracefully.

1.8.0.1

  • Removed an unnecessary version compare check that was causing some fatal errors.

1.8.0

  • Increased requirement to Genesis 1.8.0.
  • Switched over to the Genesis 1.8 admin menu class to build admin menu.

1.7.1

  • Increased requirement to Genesis 1.7.1
  • Fixed display issues in the admin screen
  • Added new hooks to the defaults array
  • Whitespace, standards, and documentation

1.6

  • Increased requirement to Genesis 1.6
  • Fixed bug with things not unhooking

1.4

  • Increased requirement to Genesis 1.4
  • Fixed undefined index bug in functions.php

1.3.1.1

  • Reduce requirement to Genesis 1.3
  • Increase requirement to WordPress 3.0

1.3.1

  • Bump to match Genesis version
  • Require Genesis 1.3.1
  • Added new unhook options
  • Fixed bug with foreign language compatibility

1.2

  • Bump to match Genesis version
  • Require Genesis 1.2.1
  • Update hooks for Genesis 1.2.1

0.9

  • Add new hooks, remove deprecated hooks
  • Fix textarea bug with HTML entities
  • Bump to pre-release 0.9 branch

0.1

  • Initial Release