[WordPress] 外掛分享: George Page Name Retrieval

首頁外掛目錄 › George Page Name Retrieval
10+
安裝啟用
尚無評分
2033 天前
最後更新
問題解決
WordPress 2.8.6+ v1.1.2 上架:2009-12-20

內容簡介

您有一個主題,需要過濾某些頁面,使其顯示獨特或進行一些自定義操作。為了在您的主題中進行這些自定義修改,您需要獲取頁面 ID、標題或永久鏈接,然後當該頁面加載時,您可以適當地操作。在「George Page Name ID Retrieval」之前,沒有簡單的方法來檢索此頁面/文章信息。George讓這項任務變得非常簡單。您現在可以直接從 PHP API 或從 WordPress 頁面/文章中使用短代碼獲取此信息。

使用方法

您可以從您的 WordPress 帖子和頁面或者 PHP/主題文件中使用 George。要使用 API,只需調用返回所需頁面信息的函數。為此,有三個 API:

george_get_post_id(); => 返回當前頁面/文章的文章 ID
george_get_post_title(); => 返回頁面標題
george_get_post_name(); => 返回永久鏈接
george_get_pageid_by_permalink($permalink); => 返回指定永久鏈接的頁面/文章 ID
george_get_permalink_by_id($id); => 返回指定頁面/文章 ID的永久鏈接
george_display_shopp_cart_count($url); => 返回指向您的 Shopp 購物車頁面的鏈接,以及總共購物車商品數量,例如「購物車(0)」[需要安裝和啟用 Shopp]

您還可以通過短代碼從 WordPress 頁面/文章調用 API。

[george-query choice=”id|title|name|outid|outperm” value=”permalink|id|url”] => 支援以下選項:

id = 頁面/文章 ID
title = 頁面/文章標題
name = 頁面/文章永久鏈接
outperm = 包含要檢索的頁面 ID 的永久鏈接
outid = 包含指定永久鏈接的頁面 ID
shopp = 獲取您的 Shopp 購物車的購物車數量

您需要在雙引號之間輸入以下值之一:

permalink(outid選項)
id(outperm選項)
url,即您的 Shopp 購物車頁面的 URL

自定義

此插件的代碼直接,易於自定義。如果您定制了此插件並提交了更改,我們將在感謝中提到您的自定義。

您可以編輯george_display_shopp_cart_count()函數,以返回與「購物車」不同的文本。

致謝

感謝所有幫助 George 成為更好插件的人!

聯繫方式

如需支援,請訪問https://github.com/presspage2018/george-page-name-id-retrieval/issues。您需要在github.com上註冊免費帳戶。

如有問題、評論或請求,請聯繫[email protected]或訪問以上論壇。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「George Page Name Retrieval」→ 直接安裝(推薦)

原文外掛簡介

You have a theme and you need to filter certain pages to either display uniquely or perform
some customized operation. In order to make these custom modifications in your theme, you need
to get the page id, title or permalink and then when that page is loaded, you can act
appropriately. Before “George Page Name ID Retrieval,” ther was no easy way of retrieving this
page/post information. George makes this task very easy. You can now retrieve this information
directly in your theme files from PHP API’s, or from your wordpress pages/posts using shortcodes
Usage
You may use George either in you PHP/Theme files or from your WordPress posts
and pages. To use the API, simple invoke the function that returns the page
information requested. There are three API’s for this purpose:

george_get_post_id(); => Returns the Post ID of the current page/post
george_get_post_title(); => Returns the Page Title
george_get_post_name(); => Returns the permalink page/post name
george_get_pageid_by_permalink($permalink); => Returns the page/post ID for the specified permalink
george_get_permalink_by_id($id); => Returns the permalink for the specified page/post id
george_display_shopp_cart_count($url); => Returns a link to your Shopp shopping cart page with the total cart items as, Shopping Cart (0) [requires Shopp to be installed and activated]

You can also invoke the API’s from your WordPress pages/posts through short codes.
[george-query choice=”id|title|name|outid|outperm” value=”permalink|id|url”] => where,

id = the page/post id
title = the page/post title
name = the page/post permalink name
outperm = contains the permalink of the page id to retrieve
outid = contains the id of the page from the specified permalink
shopp = gets the cart count for your Shopp shopping cart

You enter one of the following values between double quotes:

permalink for choice outid
id for choice outperm
url is the url of your Shopp shopping cart page

Customization
The code written for this plugin is straight forward and can easily be customized.
If you do customized this plugin and submit your changes to us, we will make honorable
mention of your customization in the Credits.
You can edit the george_display_shopp_cart_count() function to return a different text other
than “Shopping cart”
Credits
We make honorable mention to anyone who helps make George a better plugin!
Contact
For support, go to https://github.com/presspage2018/george-page-name-id-retrieval/issues. You will require a free account on github.com.0
Please contact [email protected] or visit the above forum with questions, comments, or requests.

文章
Filter
Apply Filters
Mastodon