Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #550967

    Hello,
    Do You know how to do it?
    Regards
    Piotr

    #551011

    Hey 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!
    Yigit

    #551015

    Thank You Yigit, but You I’m not clear enough :)

    I need to remove tag rel canonical from source code od search results pages.

    #551021

    Hi!

    Can you please post a screenshot? :)

    Best regards,
    Yigit

    #551024

    When 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?

    #553108

    Hi Yigit,
    Could You help me with this?
    Regards
    Piotr

    #556066

    Hey!

    Please post the link to your page where we can see

    <link rel=”canonical” href=”websiteadress” />

    in your source code.

    Regards,
    Yigit

    #556075

    Here You are:

    #556088

    Hi!

    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,
    Yigit

    #556093

    I 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

    #556096

    Hi!

    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!
    Yigit

    #556105

    I 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.
    #558253

    Hi Yigit
    any idea?
    Regards
    Piotr

    #558895

    Hey!

    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,
    Josue

    #559088

    Thank 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.
    #559102

    Yes, I use Yoast SEO.
    I added this code to function.php but canonical is still exist.

    #559115

    Hi,

    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,
    Josue

    #559122

    Ok, there it is

    #559137

    Hi!

    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,
    Josue

    #559152

    It work!!! Great, Thank You :)

    #559154

    Ups, it’s not. This code remove canonical from entire website.

    #559439

    Hey!

    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-seo

    Cheers!
    Josue

Viewing 22 posts - 1 through 22 (of 22 total)
  • You must be logged in to reply to this topic.