开发者 | coffee2code |
---|---|
更新时间 | 2021年11月21日 15:59 |
捐献地址: | 去捐款 |
PHP版本: | 4.6 及以上 |
WordPress版本: | 5.8 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
/wp-content/plugins/
).c2c_get_current_user_custom()
if you wish to access user custom fields for the currently logged
in user. Use the function c2c_get_user_custom()
to access user custom fields for a specified user. Use the function
c2c_get_author_custom()
to access custom fields for the current author (when on the permalink page for a post, page, or
in a loop). Prepend either of the three mentioned functions with 'echo' to display the contents of the custom field; or
use the return value as an argument to another function.The user profile page within WordPress provides inputs for a handful of user custom fields (first_name, last_name, aim, yim, jabber, description, etc). However, you're probably more interested in creating your own user custom fields. In that case, you'll have to use another plugin to store custom fields for users, or directly use WordPress functions manually.
If you use the block editor (aka Gutenberg, which is the default editing experience as of WordPress 5.0), then the shortcode builder is not available yet so this situation would be moot for you. For the classic editor, when on the Write or Edit admin pages for a page or post, find the "Screen Options" link near the upper right-hand corner. Clicking it slides down a panel of options. In the "Show on screen" section, uncheck the checkbox labeled "Get User Custom Field Values - 代码". This must be done separately for posts and for pages if you want the shortcode builder disabled for both sections.
If you use the block editor (aka Gutenberg, which is the default editing experience as of WordPress 5.0), then the shortcode builder is not available yet. If you aren't able to include scripts in your posts (i.e. you don't have the 'unfiltered_html' capability), then the shortcode builder is not available to you. Only those with the editor or administrator role (except on Multisite) or the super administrator role can make use of this plugin's shortcode. For the classic editor, the shortcode builder/wizard is available in the admin when writing or editing a page or post. On the edit/create page, it'll be a sidebar widget (in this context, also known as a metabox) labeled "Get User Custom Field Values - Shortcode". If you don't see it there (which may be the case since it is hidden by default), find the "Screen Options" link near the upper righthand corner of the page. Clicking it slides down a panel of options. In the "Show on screen" section, check the checkbox labeled "Get User Custom Field Values - Shortcode". This must be done separately for posts and for pages if you want the shortcode builder enabled for both sections.
Yes, any of the boxes on the page when creating/editing posts can be rearranged by dragging and dropping the box name. At the very top of the shortcode builder box the cursor will turn into a four-way array indicating you can click to drag that box. You can move it under the post content box, or higher up on the right side.
Sometimes you have to ensure the text editor has focus. Click within the text editor and make sure the cursor is positioned at the location you want the shortcode to be inserted. Then click the button and the shortcode should get inserted there.
Yes, except that the shortcode builder (a custom tool to facilitate making use of the plugin's shortcode when creating a post) has not been ported over yet. The template tags, widget, and shortcode itself all function properly.
Yes.
can_author_use_shortcodes()
'get_user_custom_field_values/can_author_use_shortcodes'
'get_user_custom_field_values/show_metabox'
to customize if shortcode builder metabox is shownshow_metabox()
create_post()
phpunit/bin/
to tests/bin/
phpunit/bootstrap.php
into tests/phpunit/
phpunit/tests/
to tests/phpunit/tests/
phpunit/
to house all files related to unit testingbin/
to phpunit/bin/
tests/bootstrap.php
to phpunit/
tests/
to phpunit/tests/
phpunit.xml
to phpunit.xml.dist
per best practicesregister()
c2c_get_user_custom_field_values_post_types
filter as an array