开发者 | WebFactory |
---|---|
更新时间 | 2024年10月14日 02:18 |
PHP版本: | 7.2 及以上 |
WordPress版本: | 6.6 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
Just use the option "Skip pages or posts" under the tab "Exceptions".
For a more custom approach use the action wpel_apply_settings
:
`add_action( 'wpel_apply_settings', function () {
global $post;
$ignored_post_ids = array( 1, 2, 4 );
if ( in_array( $post->ID, $ignored_post_ids ) ) {
return false;
}
return true;
}, 10 );`
Using this filter you can ignore any request, like certain category, archive etcetera.
There's an option for ignoring links containing a certain class (under tab "Exceptions").
For a more flexible check on ignoring links you could use the filter wpel_before_apply_link
:
add_action( 'wpel_before_apply_link', function ( $link ) { // ignore links with class "some-cls" if ( $link->has_attr_value( 'class', 'some-cls' ) ) { $link->set_ignore(); } }, 10 );
Create redirect by using the wpel_link
action. Add some code to functions.php of your theme, like:
`add_action( 'wpel_link', function ( $link ) {
// check if link is an external links
if ( $link->is_external() ) {
// get current url
$url = $link->get_attr( 'href' );
// set redirect url
$redirect_url = '//somedom.com?url='. urlencode( $url );
$link->set_attr( 'href', $redirect_url );
}
}, 10, 1 );`
By adding this JavaScript code to your site: `jQuery(function ($) { $('a[data-wpel-link="external"]').click(function (e) { // open link in popup window window.open($(this).attr('href'), '_blank', 'width=800, height=600'); // stop default and other behaviour e.preventDefault(); e.stopImmediatePropagation(); }); });` See more information on the window.open() method.
Add this JavaScript code to your site:
jQuery(function ($) { $('a[data-wpel-link="external"]').click(function (e) { if (!confirm('Are you sure you want to open this link?')) { // cancelled e.preventDefault(); e.stopImmediatePropagation(); } }); });
Use some JavaScript code for opening PDF files in a new window:
jQuery(function ($) { $('a[href$=".pdf"]').prop('target', '_blank'); });
Use some CSS style to change the icon for secure sites using https:
a[href^="https"] .wpel-icon:before { content: "\f023" !important; }
The code \f023
refers to a dashicon or font awesome icon.
If your plugin contains links it might be filtered by the WPEL plugin as well, causing a conflict. Here are some suggestions on solving the problem:
data-wpel-link="ignore"
to links that need to be ignored by WPEL pluginwpel_before_apply_link
-action to ignore your links (f.e. containing certain class or data-attribute)wpel_apply_settings
-filter to ignore complete post, pages, categories etcYou can report security bugs through the Patchstack Vulnerability Disclosure Program. The Patchstack team help validate, triage and handle any security vulnerabilities. Report a security vulnerability.