Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1130349
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm looking for a way to remove the title attribute from links. There is a old plugin but it breaks the site.
The title I would like to remove is in the sidebar widget. Thats the code of the widget part:
// Coupon Catetories Widget
class CLPR_Widget_Coupon_Categories extends WP_Widget {
function __construct() {
$widget_ops = array( 'description' => __( 'Display the coupon categories.', APP_TD ), 'classname' => 'widget-coupon-cats' );
parent::__construct( 'coupon-cats', __( 'Clipper Coupon Categories', APP_TD ), $widget_ops );
}
function widget($args, $instance) {
global $wpdb;
extract( $args );
$title = apply_filters('widget_title', empty($instance['title']) ? __( 'Coupon Categories', APP_TD ) : $instance['title']);
if (strpos($before_widget, 'customclass') !== false)
$before_widget = str_replace('customclass', 'cut', $before_widget);
else
$before_widget = str_replace('customclass', '', $before_widget);
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
$tax_name = APP_TAX_CAT;
echo '<div class="coupon-cats-widget"><ul class="list">';
wp_list_categories("orderby=name&order=asc&hierarchical=1&show_count=0&pad_counts=0&app_pad_counts=1&hide_empty=0&depth=1&number=&title_li=&taxonomy=$tax_name");
echo '</ul></div>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
return $new_instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = esc_attr($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<?php
}
}
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm looking for a way to remove the title attribute from links. There is a old plugin but it breaks the site.
The title I would like to remove is in the sidebar widget. Thats the code of the widget part:
// Coupon Catetories Widget
class CLPR_Widget_Coupon_Categories extends WP_Widget {
function __construct() {
$widget_ops = array( 'description' => __( 'Display the coupon categories.', APP_TD ), 'classname' => 'widget-coupon-cats' );
parent::__construct( 'coupon-cats', __( 'Clipper Coupon Categories', APP_TD ), $widget_ops );
}
function widget($args, $instance) {
global $wpdb;
extract( $args );
$title = apply_filters('widget_title', empty($instance['title']) ? __( 'Coupon Categories', APP_TD ) : $instance['title']);
if (strpos($before_widget, 'customclass') !== false)
$before_widget = str_replace('customclass', 'cut', $before_widget);
else
$before_widget = str_replace('customclass', '', $before_widget);
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
$tax_name = APP_TAX_CAT;
echo '<div class="coupon-cats-widget"><ul class="list">';
wp_list_categories("orderby=name&order=asc&hierarchical=1&show_count=0&pad_counts=0&app_pad_counts=1&hide_empty=0&depth=1&number=&title_li=&taxonomy=$tax_name");
echo '</ul></div>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
return $new_instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = esc_attr($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<?php
}
}
Share
Improve this question
edited Nov 27, 2018 at 21:53
joloshop
asked Nov 27, 2018 at 20:44
joloshopjoloshop
211 silver badge8 bronze badges
8
|
Show 3 more comments
1 Answer
Reset to default 1You could provide some more details, like what title attributes you are trying to remove. In the navigation, content, etc. Anyway, you could try adding this to your theme or child theme's functions.php file, I have yet to test it though.
function remove_title_attributes($input) {
return preg_replace('/\s*title\s*=\s*(["\']).*?\1/', '', $input);
}
add_filter('wp_list_pages', 'remove_title_attributes');
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm looking for a way to remove the title attribute from links. There is a old plugin but it breaks the site.
The title I would like to remove is in the sidebar widget. Thats the code of the widget part:
// Coupon Catetories Widget
class CLPR_Widget_Coupon_Categories extends WP_Widget {
function __construct() {
$widget_ops = array( 'description' => __( 'Display the coupon categories.', APP_TD ), 'classname' => 'widget-coupon-cats' );
parent::__construct( 'coupon-cats', __( 'Clipper Coupon Categories', APP_TD ), $widget_ops );
}
function widget($args, $instance) {
global $wpdb;
extract( $args );
$title = apply_filters('widget_title', empty($instance['title']) ? __( 'Coupon Categories', APP_TD ) : $instance['title']);
if (strpos($before_widget, 'customclass') !== false)
$before_widget = str_replace('customclass', 'cut', $before_widget);
else
$before_widget = str_replace('customclass', '', $before_widget);
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
$tax_name = APP_TAX_CAT;
echo '<div class="coupon-cats-widget"><ul class="list">';
wp_list_categories("orderby=name&order=asc&hierarchical=1&show_count=0&pad_counts=0&app_pad_counts=1&hide_empty=0&depth=1&number=&title_li=&taxonomy=$tax_name");
echo '</ul></div>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
return $new_instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = esc_attr($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<?php
}
}
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 6 years ago.
Improve this questionI'm looking for a way to remove the title attribute from links. There is a old plugin but it breaks the site.
The title I would like to remove is in the sidebar widget. Thats the code of the widget part:
// Coupon Catetories Widget
class CLPR_Widget_Coupon_Categories extends WP_Widget {
function __construct() {
$widget_ops = array( 'description' => __( 'Display the coupon categories.', APP_TD ), 'classname' => 'widget-coupon-cats' );
parent::__construct( 'coupon-cats', __( 'Clipper Coupon Categories', APP_TD ), $widget_ops );
}
function widget($args, $instance) {
global $wpdb;
extract( $args );
$title = apply_filters('widget_title', empty($instance['title']) ? __( 'Coupon Categories', APP_TD ) : $instance['title']);
if (strpos($before_widget, 'customclass') !== false)
$before_widget = str_replace('customclass', 'cut', $before_widget);
else
$before_widget = str_replace('customclass', '', $before_widget);
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
$tax_name = APP_TAX_CAT;
echo '<div class="coupon-cats-widget"><ul class="list">';
wp_list_categories("orderby=name&order=asc&hierarchical=1&show_count=0&pad_counts=0&app_pad_counts=1&hide_empty=0&depth=1&number=&title_li=&taxonomy=$tax_name");
echo '</ul></div>';
echo $after_widget;
}
function update($new_instance, $old_instance) {
return $new_instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = esc_attr($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', APP_TD ); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
<?php
}
}
Share
Improve this question
edited Nov 27, 2018 at 21:53
joloshop
asked Nov 27, 2018 at 20:44
joloshopjoloshop
211 silver badge8 bronze badges
8
- Can you ellaborate a little as to why you are trying to do this? What problem does it solve? – Tom J Nowell ♦ Commented Nov 27, 2018 at 21:35
-
I can not change certain description from taxonomy categories and the
title=shows irritating content. Therefore I need to remove it. Also for SEO Reason. – joloshop Commented Nov 27, 2018 at 21:39 -
Whoever told you it affected SEO was talking BS. Would it not have been better to ask how to change those descriptions? Pretty much everything can be changed, even if it isn't clear how. Additionally, by understanding where the
titleattributes and links are, you might get a better answer. Right now the assumption is that you want them removed from links inside post content, or, the super old links table functionality – Tom J Nowell ♦ Commented Nov 27, 2018 at 21:42 - They are located in a custom category list in one of the sidebar widgets. – joloshop Commented Nov 27, 2018 at 21:50
- How is the custom category list widget implemented? – Tom J Nowell ♦ Commented Nov 28, 2018 at 1:38
1 Answer
Reset to default 1You could provide some more details, like what title attributes you are trying to remove. In the navigation, content, etc. Anyway, you could try adding this to your theme or child theme's functions.php file, I have yet to test it though.
function remove_title_attributes($input) {
return preg_replace('/\s*title\s*=\s*(["\']).*?\1/', '', $input);
}
add_filter('wp_list_pages', 'remove_title_attributes');
本文标签: remove the title attribute from links
版权声明:本文标题:remove the title attribute from links 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749147446a2323236.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


title=shows irritating content. Therefore I need to remove it. Also for SEO Reason. – joloshop Commented Nov 27, 2018 at 21:39titleattributes and links are, you might get a better answer. Right now the assumption is that you want them removed from links inside post content, or, the super old links table functionality – Tom J Nowell ♦ Commented Nov 27, 2018 at 21:42