how to make rss feeds unclickable in wordpress - wordpress

i have created wordpress blog and i added the rss widget that comes with wordpress.
but i need to make the rss feeds unclickable to so that my blog visitors will stay in my site and not leave, so i want clicking on an item in the feeds to do nothing.
i have tried to look in rss.php file but i didn't know what to do...
i want the href to be removed.
or if anyone can suggest a rss widget plogin that doesn't link to its source!
can anyone please help me with that?

You can disable clicks using jQuery. Try adding this to your functions.php.
add_action('wp_footer','unclickable_rss');
function unclickable_rss() {
?>
<script>
jQuery(document).ready(function($) {
$('.widget_rss a').on('click',function() {
return false;
});
});
</script>
<?php
}

Related

NEED HELP - how to make an excerpt of the post clickable?

I am working in Wordpress, and I am using Elementor. Elementor has a native feature for the title of the posts and images to link to the post.
But if I add an excerpt text, it doesn't link to the post. It is not clickable. The read more button does, but not the excerpt of the post.
I am trying to create something like this: greatist.com Every post on their website is clickable - the excerpt, the title, and the image.
My excerpts are really short like on that website, and I would really like them to be clickable. I have absolutely no idea how to do this and I'm beginning to think it's not possible. I am using Hello Elementor theme.
I would deeply appreciate anyone's help. I just registered to ask this question.
You can always try to save text as an photo and make it clickable or make a full section clickable.To do this try to use plugin called "Make Column Clickable Elementor".
Add this code to your website:
const postExcerpts = document.querySelectorAll('.elementor-posts .elementor-post .elementor-post__excerpt');
postExcerpts.forEach(postExcerpt => {
const postUrl = postExcerpt.parentNode.querySelector('.elementor-post__title a').href;
postExcerpt.addEventListener('click', () => {
window.location.href = postUrl;
});
});
This can be added using a script tag. Choose from the following options:
Add this code as a script tag in your functions.php file, to be rendered at the end of the page (wp_footer action hook).
If you have Elementor Pro, use its built-in Custom Code feature to add the code in a script tag to the end of the body tag.
It's recommended to add a pointer cursor so the user will know the excerpt is a link. This can be achieved by adding the following CSS to your style.css file.
.elementor-posts .elementor-post .elementor-post__excerpt {
cursor: pointer;
}

WordPress tinymce default link's target

I'm trying to edit the WordPress TinyMCE editor so all the links has the target = "_blank". I've tried with jquery to set the 'Open link in new tab' checkbox to be always checked but, no results.
Thank you
You can accomplish this with the default_link_target setting in your TinyMCE configuration: https://www.tinymce.com/docs/plugins/link/#default_link_target
Here is a TinyMCE Fiddle of this in action: http://fiddle.tinymce.com/31faab
To do this in Wordpress you will need to create a simple plugin that modifies this setting as TinyMCE is loaded. It would look something like this:
<?php
add_filter('tiny_mce_before_init', 'add_my_options', 1000);
function add_my_options($opt) {
$opt['default_link_target'] = "_blank";
return $opt; //you must return $opt to not break things
}
?>
If you have never created a WP plugin they are not hard to build and there are plenty of examples on the web.

How to remove target="_blank" from posts?

I'm developing a Wordpress Website. New posts redirect to an external link using
target="_blank"
automatically. And I want it to be deleted from posts. I tried to modify funcitons.php but I still didn't find the appropiate code...
How can I achieve that?
Definitely not the prettiest way, but this should do until you find code that adds target to external links
add_filter('the_excerpt', 'myfilter', 15);
add_filter('the_content', 'myfilter', 15);
function myfilter($content)
{
return preg_replace('#target=["\']?_blank["\']?#mi','',$content);
}

Anchors not working on search results page using woocommerce

I am developing a site for a client using Wordpress and Woocommerce and have an issue where I can not click on any of the anchors on the search results page.
The search results page is here: http://79.170.44.83/newcityused.com/?s=chair
I can see nothing in the CSS that would make this happen.
I have deactivated all of the plugins with no joy.
I'm lost.
Has anyone else experienced this or know of a solution?
You have a class .search inside your 'body' tag and then you have a js that is something like this:
jQuery(function(){
jQuery('.search').on('click', function(e) {
jQuery('.search-form').toggleClass("expand");
e.preventDefault();
});
})
I think that you are preventing the default clicks in here... so remove the e.preventDefault it made work, let me know...

wordpress backend: retrict post tags to site tags only

In the post screen, I want to remove the option of multi-authors being able to 'free tag' their posts. In other words, only allow tags that have been preset in the admin tags section. (These tags are of course visible in the tag cloud in the posts screen.) The concept is to prevent authors from introducing random tags in their posts, leading to duplication and confusion.
Add the following code to the function.php file in the WordPress theme you are using. Take note of the closing and opening PHP tags.
function disable_tags()
{
?>
<script type='text/javascript'>
jQuery(document).ready(function() {
jQuery('#new-tag-post_tag').attr("disabled", "disabled").css("display", "none");
jQuery('.tagadd').attr("disabled", "disabled").css("display", "none");
jQuery('#post_tag').css("display", "none");
});
</script>
<?php
}
add_action('admin_head', 'disable_tags');
This will disable and hide the field and Add New Tag button making the only tagging option the pre-defined tags in the admin section.

Resources