Code

Support for SEO Friendly Images Pro for WordPress

Support for SEO Friendly Images Pro for WordPress

Cart 721 sales

Pascal-Bajorat supports this item

Supported

This author's response time can be up to 2 business days.

Popular questions for this item

Remove PB SEO Friendly Images Pro filter for specific pages

function remove_pbseofi(){
  if( get_the_ID() == 12 ) {
    remove_filter( 'the_content', array('pbSEOFriendlyImages', 'prepareContentImages'), 999);
  }
}
add_action('wp', 'remove_pbseofi');

Problem with WooCommerce Zoom feature

If you work with the product gallery zoom feature in WooCommerce our SEO Friendly Images Pro plugin can’t rewrite alt or title attributes. The zoom feature has it’s own template and force images without alt or title.

You can disable the zoom with the following code changes in your theme:

function remove_image_zoom_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );

Thanks to Tye for his information about this problem.

Disable PB SEO Friendly Images for defined pages

function my_is_optimization_allowed( $is_optimization_allowed, $data ) {

  // You can use any conditional tag you need: https://codex.wordpress.org/Conditional_Tags
  // Examples:

  // disable for a specific Post ID
    if( get_the_ID === 'XX' ) {
    $is_optimization_allowed = false;
  }

  // disable for post type page
  if( get_post_type() == 'page' ) {
    $is_optimization_allowed = false;
  }

    return $is_optimization_allowed;
}

add_filter( 'is_optimization_allowed', 'my_is_optimization_allowed', 20, 2 );

Customize alt and title dynamically or extend the replacements

You can use the filter pbsfi-alt and pbsfi-title to customize the alt and title output. Both filters works on the same way, you need to use pbsfi-alt to customize your alt attribute and pbsfi-title to customize your title attribute.

You can use that codes for example in the functions.php of your theme.

Example to override the alt with a custom value

// Example to override the alt with a custom value
function custom_pbsfi_alt($alt)
{
  return 'my custom alt';  
}
add_filter('pbsfi-alt', 'custom_pbsfi_alt', 10);

Example to create your own replacements

// Example to create your own replacements
// For example %yoast_focuskw to get the post-meta "_yoast_wpseo_focuskw" (Yoast Focus Keyword)

function pbsfi_yoast_focuskw($val)
{
  $yoast_focuskw = get_post_meta( get_the_ID(), '_yoast_wpseo_focuskw', true );

  $val = str_replace('%yoast_focuskw', $yoast_focuskw, $val );

  return val;  
}
add_filter('pbsfi-alt', 'pbsfi_yoast_focuskw', 10);
add_filter('pbsfi-title', 'pbsfi_yoast_focuskw', 10);

Add SEO Friendly Optimize function to custom content

pbsfi_frontend::optimize_html( $content [required], $post_id=0 [optional - post_id], $field=null [optional - name for cache item] )

How to use:

as function

echo pbsfi_frontend::optimize_html( $content_or_html_to_optimize );

as filter

Do not set this filter for the_content, it’s only an example and the plugin will automatically set this filter.
add_filter( 'the_content', [ 'pbsfi_frontend', 'optimize_html' ], 10, 1 );

Show more

Contact the author

This author provides limited support for this item through email contact form.

Item support includes:

  • Availability of the author to answer questions
  • Answering technical questions about item’s features
  • Assistance with reported bugs and issues
  • Help with included 3rd party assets

However, item support does not include:

  • Customization services
  • Installation services

View the item support policy

by
by
by
by
by
by

Tell us what you think!

We'd like to ask you a few questions to help improve CodeCanyon.

Sure, take me to the survey