-
AuthorPosts
-
December 11, 2015 at 12:14 pm #550967
Hello,
Do You know how to do it?
Regards
PiotrDecember 11, 2015 at 1:18 pm #551011Hey pedronx!
Please add following code to Quick CSS in Enfold theme options under General Styling tab
.search .blog-categories.minor-meta, .search .text-sep:nth-child(4) { display: none; }
if that does not help, please post the link to your website and a screenshot showing the changes you would like to make. You can upload your screenshots on imgur.com or dropbox public folder and post the links here
Cheers!
YigitDecember 11, 2015 at 1:21 pm #551015Thank You Yigit, but You I’m not clear enough :)
I need to remove tag rel canonical from source code od search results pages.
December 11, 2015 at 1:34 pm #551021December 11, 2015 at 1:37 pm #551024When I search something on website, I get this code in results (in source code):
<meta name=”robots” content=”noindex,follow”/>
<link rel=”canonical” href=”websiteadress” />From SEO point of view it’s wrong and I need to remove <link rel=”canonical” href=”websiteadress” /> from code.
Do You have any idea?December 15, 2015 at 4:02 pm #553108Hi Yigit,
Could You help me with this?
Regards
PiotrDecember 21, 2015 at 5:37 pm #556066Hey!
Please post the link to your page where we can see
<link rel=”canonical” href=”websiteadress” />
in your source code.
Regards,
YigitDecember 21, 2015 at 5:45 pm #556075Here You are:
December 21, 2015 at 6:00 pm #556088Hi!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_set_follow','avia_set_nofollow'); function avia_set_nofollow(){ if(is_search()){ $meta = ''; } return $meta; }
Best regards,
YigitDecember 21, 2015 at 6:04 pm #556093I add it to function.php in child theme and get this:
Fatal error: Cannot redeclare avia_set_nofollow() (previously declared in /home/httpd/vhosts/…/httpdocs/wp-content/themes/enfold-child/functions.php:265) in /home/httpd/vhosts/…/httpdocs/wp-content/themes/enfold-child/functions.php on line 289
December 21, 2015 at 6:06 pm #556096Hi!
Please go to wp-content/themes/enfold/functions.php file and change the code above to following one
add_filter('avf_set_follow','avia_set_nofollow_search'); function avia_set_nofollow_search(){ if(is_search()){ $meta = ''; } return $meta; }
Seems like you have already declared a function with name avia_set_nofollow :)
Cheers!
YigitDecember 21, 2015 at 6:12 pm #556105I add this code
add_filter(‘avf_set_follow’,’avia_set_nofollow’);
function avia_set_nofollow(){
if ( is_search() ) {
$meta = ‘<meta name=”robots” content=”noindex, follow” />’ . “\n”;
}
return $meta;
}to functions.php in child theme to prevent robots to index search results.
1. Could You clarify what I should do now?
2. Is that Your code remove <link rel=”canonical” href=”…” /> from search results?
Regards
Piotr- This reply was modified 8 years, 11 months ago by pedronx.
December 29, 2015 at 10:10 pm #558253Hi Yigit
any idea?
Regards
PiotrJanuary 3, 2016 at 2:21 am #558895Hey!
Are you using Yoast SEO? if so try with this code:
add_action( 'plugins_loaded', 'my_plugin_override' ); function my_plugin_override() { if ( is_search() ) { add_filter( 'wpseo_canonical', '__return_false' ); } }
Regards,
JosueJanuary 4, 2016 at 11:01 am #559088Thank You Josue,
Is there a way to use it in my child theme rather than in function.php in original files?
Regards
Piotr- This reply was modified 8 years, 10 months ago by pedronx.
January 4, 2016 at 11:30 am #559102Yes, I use Yoast SEO.
I added this code to function.php but canonical is still exist.January 4, 2016 at 11:56 am #559115Hi,
You can put these codes on a new functions.php in your child theme directory. Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueJanuary 4, 2016 at 12:06 pm #559122Ok, there it is
January 4, 2016 at 12:28 pm #559137Hi!
This code should work:
add_filter('wpseo_canonical', function() { if(is_search()) return false; });
If it doesn’t please try contacting Yoast support as the canonical link is being added by the Yoast plugin and not the theme.
Regards,
JosueJanuary 4, 2016 at 1:00 pm #559152It work!!! Great, Thank You :)
January 4, 2016 at 1:03 pm #559154Ups, it’s not. This code remove canonical from entire website.
January 4, 2016 at 7:59 pm #559439Hey!
I’m not sure what could be preventing
is_search
from working with the Yoast hook here, try posting a thread in Yoast WP forum:
https://wordpress.org/support/plugin/wordpress-seoCheers!
Josue -
AuthorPosts
- You must be logged in to reply to this topic.