Support » Plugin: Nelio External Featured Image (discontinued) - Available in Nelio Content » Corrupted page when insert post grid shortcode

  • This plugin looks like not compatible with Post Grid.

    If a page or post has a Post Grid shortcode and Nelio External Featured Image working in same page or post, the internal links system break down.

Viewing 1 replies (of 1 total)
  • Plugin Author David Aguilera

    (@davilera)

    Hi!

    After a couple of tests with Post Grid (I never used it before), I think I know what’s amiss. In order to make Post Grid compatible with our plugin, I’m afraid you’ll have to edit the former.

    Open includes/functions.php and take a look at line 18:

    if($media_source == 'featured_image'){
      $thumb = wp_get_attachment_image_src( … );
      $thumb_url = $thumb['0'];
    
      if(!empty($thumb_url)){
        …
      } else {
        …
      }
    }
    elseif …

    This is where the “regular” featured image is obtained (if any) and returned. As I said in other threads and the FAQ of our plugin, NelioEFI doesn’t work when the theme (or plugin in this case) uses wp_get_attachment_image_src for obtaining the URL of a featured image (WordPress doesn’t offer any hooks for tweaking the result of that function).

    Well, you simply need to tweak that block, so that Nelio’s featured image is retrieved (if any):

    if($media_source == 'featured_image'){
      $thumb = wp_get_attachment_image_src( … );
      $thumb_url = $thumb['0'];
    
      if ( function_exists( 'uses_nelioefi' ) &&
           uses_nelioefi( get_the_ID() ) ) {
        $thumb_url = nelioefi_get_thumbnail_src( get_the_ID() );
      }//end if
    
      if(!empty($thumb_url)){
        …
      } else {
        …
      }
    }
    elseif …

    This small if block checks if our plugin is installed and if the current post is using Nelio’s external featured image. If they do, it obtains the URL of this image using Nelio’s function nelioefi_get_thumbnail_src.

    This should probably fix your issue. However, keep in mind your changes will be reverted whenever Post Grid is updated, so save this thread somewhere.

    Let me know if it worked!

    Best,
    David

Viewing 1 replies (of 1 total)
  • The topic ‘Corrupted page when insert post grid shortcode’ is closed to new replies.