Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter RXC

    (@rxc)

    When I first wrote this post, I was thinking using async as Google recommends using it and I hadn’t a real perspective about this concept.

    I just thought that I needed to add the word async to my scripts to be OK with Google.

    Later, I managed to fix it by modifying one single line in one file inside W3TC plugin (a really simple fix by adding the word async in the right place, just it), but I soon realized that this change broke my site completely, as the async loading of scripts means that you don’t control the order where scripts are loaded, so there are times your site loads right and other that it doesn’t with lots of undefined functions. It depends on every user browser and it’s something random.

    Using async is a feature that really needs heavy knowledge of programming, and I don’t recommend using it unless you are able to modify several files inside your theme. It requires knowing what scripts are loaded, what for are each of them and that you are able to modify those scripts to wait for their dependencies to be loaded first.

    So, as a rule of thumb, if you are not able to find for yourself the file that should be modified inside W3TC, async is not for you.

    Here’s the way. There is an error in the copy-paste that I will report to the developers.
    If you have a look at plugins/transposh/wp/transposh_3rdparty.php you’ll notice this (line 216):

    /**
    * This function integrates with yoast sitemap generator, and adds for each viewable language, the rest of the languages url
    * Also – priority is reduced by 0.2
    * And this requires the following patch in class-sitemaps.php
    * For future yoast versions, and reference, look for this function:
    if ( ! in_array( $url[‘loc’], $stackedurls ) ) {
    // Use this filter to adjust the entry before it gets added to the sitemap
    $url = apply_filters( ‘wpseo_sitemap_entry’, $url, ‘post’, $p );
    if ( is_array( $url ) && $url !== array() ) {
    $output .= $this->sitemap_url( $url );
    $stackedurls[] = $url[‘loc’];
    }
    }

    And change to:

    if ( ! in_array( $url[‘loc’], $stackedurls ) ) {
    // Use this filter to adjust the entry before it gets added to the sitemap
    $url = apply_filters( ‘wpseo_sitemap_entry’, $url, ‘post’, $p );
    if ( is_array( $url ) && $url !== array() ) {
    $output .= $this->sitemap_url( $url );
    $stackedurls[] = $url[‘loc’];
    }
    $langurls = apply_filters( ‘wpseo_sitemap_language’,$url);
    if ( is_array( $langurls )) {
    foreach ($langurls as $langurl) {
    $output .= $this->sitemap_url( $langurl );
    }
    }

    But there is an error in the code provided (missing bracket). This is the working code:

    if ( ! in_array( $url['loc'], $stackedurls ) ) {
            // Use this filter to adjust the entry before it gets added to the sitemap
            $url = apply_filters( 'wpseo_sitemap_entry', $url, 'post', $p );
    			if ( is_array( $url ) && $url !== array() ) {
    			  $output .= $this->sitemap_url( $url );
    			  $stackedurls[] = $url['loc'];
    			}
    		} // ******* this one was missing
    
            $langurls = apply_filters( 'wpseo_sitemap_language',$url);
            if ( is_array( $langurls )) {
              foreach ($langurls as $langurl) {
              $output .= $this->sitemap_url( $langurl );
            }
          }

    @afzalcoder
    So true, I had taken for sure that the strong for the last breadcrumb is always shown, not an option. Now the code is fully functional. Thanks.

    Hi afzalCoder, your code lacks of condition in if statement, hence not working.

    This is the WORKING version that needs to be pasted into functions.php:

    add_filter( 'wpseo_breadcrumb_single_link', 'link_to_last_crumb' , 10, 2); 
    
      function link_to_last_crumb( $output, $crumb){          
    
                        if( strpos($output, '<strong class="breadcrumb_last"') > 0 ){
    
                            $output = '<a property="v:title" rel="v:url" href="'. $crumb['url']. '" >';
                            $output.= $crumb['text'];
                            $output.= '</a>';
                        }
    
                return $output;
    }

    Any update about this matter?

    Yes, it does work.

    Let’s see if this is the final fix for the plugin from the author, or maybe he’ll make another workaround.
    But meanwhile, it’s working.
    Thanks!

    This has nothing to do with the plugin but with some basic Javascript

    https://www.w3schools.com/jsref/prop_text_readonly.asp

    You’re welcome.

    Thread Starter RXC

    (@rxc)

    Missing also pure css3 box-shadow without specific browser selectors.

    box-shadow: 0 1px 3px rgba(0,0,0,0.6);

Viewing 8 replies - 1 through 8 (of 8 total)