开发者 | coffee2code |
---|---|
更新时间 | 2021年7月12日 13:51 |
捐献地址: | 去捐款 |
PHP版本: | 4.9 及以上 |
WordPress版本: | 5.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Hi => Hello
Would have the effect of changing "His majesty" to "Hellos majesty".
<a href="" style=":mycss:">text</a>
:aol: => <a href='http://www.aol.com'>America Online</a>
), visitors to your site will see the linked, expanded text due to the text replace, but a database search would never turn up a match for "America Online"./wp-content/plugins/
).Settings
-> Text Replace
admin options page and customize the options (notably to define the shortcuts and their replacements)No. The plugin filters post content on-the-fly as it is being output or displayed. The data saved to the database is as you typed it.
No. The plugin filters post content on-the-fly as it is being output or displayed. The actual data stored in the database, whether it be pre-existing or new, is never affected by this plugin.
Yes, if they include strings that you've now defined as shortcuts.
By default, the plugin filters the post content, post excerpt, widget text, and optionally comments and comment excerpts. You can use the "More filters" setting to specify additional filters to be processed for text replacement. You can also programmatically use the 'c2c_text_replace_filters' filter to modify the affected filters (see Developer Documentation section).
The easiest way would be to add "the_title" (or some other filter's name) as a line in the "More filters" setting. That setting allows any additional specified filters to be processed for text replacement. You can also programmatically add to the list of filters that get text replacements. See the Developer Documentation section for an example.
By default, yes. There is a setting you can change to make it case insensitive. Or you can use the 'c2c_text_replace_case_sensitive' filter (see Developer Documentation section).
Rest assured search engines will see those posts since they only ever see the posts after the shortcuts have been replaced. However, WordPress's search function searches the database directly, where only the shortcut exists, so WordPress doesn't know about the replacement text you've defined.
By default, yes. There is a setting you can change so that only the first occurrence of the term in the post gets replaced. Or if you are a coder, you can use the 'c2c_text_replace_once' filter (see Developer Documentation section).
Yes. While this plugin is compatible with many other plugins that modify post and widget text, this plugin has explicit built-in support for Advanced Custom Fields and Elementor, which provide additional content areas. See documentation on the hook 'c2c_text_replace_third_party_filters' for a complete list of default supported third-party filters and how to enable compatibility with other plugins and themes. If you know the name of the filter provided by a plugin, you can add it to the "More filters" setting to have its value processed for text replacement.
Yes.
get_default_filters()
to return the default core and/or third-party filters processed by the plugin'admin_enqueue_scripts'
action instead of during 'init'
is_plugin_admin_page()
in help_tabs()
instead of reproducing its functionalityis_plugin_admin_page()
is used before 'admin_init'
action is firedis_plugin_admin_page()
to use get_current_screen()
when availablestyle
tagc2c_{PluginName}_Plugin_051
to c2c_Plugin_060
get_c2c_string()
as a getter for translated stringsget_c2c_string()
whitelist_options()
to allowed_options()
add_allowed_options()
instead of deprecated add_option_whitelist()
for WP 5.5+allowed_options
filter instead of deprecated whitelist_options
for WP 5.5+is_wp_version_cmp()
and get_c2c_string()
)is_wp_version_cmp()
as a utility to compare current WP version against a given WP versioncontextual_help()
to be easier to read, and correct function docblocksnumber_format_i18n()
to format integer value within input fieldreadme_url()
to refer to plugin's readme.txt on plugins.svn.wordpress.orgtests/phpunit/
to house all files related to PHP unit testingbin/
to tests/bin/
tests/bootstrap.php
into tests/phpunit/
tests/
to tests/phpunit/tests/
phpunit.xml
to phpunit.xml.dist
per best practicesoptions_page_description()
tearDown()
reset_options()
callc2c_text_replace_third_party_filters
for filtering third party filtersc2c_text_replace_filter_priority
for filtering hook priority for text replacement handlerreplace_once
value to ensure a valid value is used as arg for preg_replace()
plugins_loaded
action instead of on loadprintf()
rather than using string concatenationadd_settings_field()
to be an arraylabel
instead of p
label
for help text for checkboxes, otherwise use p
textarea
displays as a block to prevent orphaning of subsequent help textcapture_filter_value()
as a method for capturing default values provided for a filterget_filter_names()
as a helper method for getting the default and third-party filter namesunhook_default_filters()
as a helper method to unhook plugin's default filters hooked to text_replace()
test_does_not_replace_within_markup_attributes()
test_does_not_replace_within_markup_attributes()
to test_does_not_replace_within_markup_attributes_but_does_between_tags()