How can I apply a WP filter on specific plugin version

Maybe you are looking for the plugin_row_meta filter, where you could add a custom filter like this one: add_filter(‘plugin_row_meta’, ‘custom_plugin_row_meta’, 10, 4 ); function custom_plugin_row_meta($meta, $file, $data, $status) { // // do some filtering on the version text of the Akismet plugin // if( $file === ‘akismet/akismet.php’ ) // $meta[0] = “Version 3.14159265359”; // BAD … Read more

How can I exclude a dynamic URL to show a popup created using ‘WordPress Popup’ plugin

Within the javascript file the developer calls a method when the page loads. jQuery(window).load(po_selectiveLoad); This methods calls another method. function po_selectiveLoad() { po_load_popover(); } If you replace it with this function po_selectiveLoad() { var urlString = new String(window.location.href); if (!urlString.match(/\/cart\//)) { po_load_popover(); } } Of course this is not good because you will need to … Read more

change add to cart button link [closed]

After hours of research, i found a somewhat weird solution but somehow works. I used the woocommerce_is_purchasble hook. It passes 2 parameters is_purchasable and object (WC_Product) Which I can now get the product total number of stock. Here’s what I did. function order_is_purchasable($is_purchasable, $object) { if($object->get_total_stock() > 50){ echo ‘<a style=”margin-bottom: 10px;” href=”” class=”button”>Call to … Read more

Infinite scroll messing up nth:of-type

You’ve got to take the type in :nth-of-type() literally. It only takes into account the type of the element (in this case DIV). The selector doesn’t matter. :nth-of-type() works the same, except that it only considers element of the given type. http://quirksmode.org/css/selectors/nthchild.html Unfortunately I can’t imagine there is a nice solution for the moment. Maybe … Read more

Cropping images from top center using Jetpack Photon

We discussed about this issue in the WordPress.org support forums. Here is a code that should do the trick: /* * Let’s add support for Photon – that won’t be necessary once Jetpack 2.3.2 is out. * You’ll be able to use apply_filters( ‘jetpack_photon_url’… directly * See http://jetpack.me/2013/07/11/photon-and-themes/ */ if( function_exists( ‘jetpack_photon_url’ ) ) { … Read more

Custom url rewriting

[answer updated as wanted] It’s better to hook your function to generate_rewrite_rules so you won’t have fall into infinite loops and flushing rewrite rule on every request. So you can do this: function add_my_rules($wp_rewrite) { $new_rules = array( ‘^cityprofile/\?city=(Sydeny|Melbourne|Brisbane)$’ => $wp_rewrite->preg_index(1) // for 3 cities ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_action(‘generate_rewrite_rules’, ‘add_my_rules’); and … Read more

Insert Message before content of after title

You need to use ‘the_content‘ filter function add_before_content($content) { return ‘Before content area ‘.$content; } add_filter(‘the_content’, add_before_content); It will still be inside the content div. If you want it outside the div you have to edit related template files i.e. single.php or templates/content-single.php. It all depends on which pages you want to apply it.

Undefined index: action plugin problem

The logic on line 225 is bad. if( isset($wp_logo_slider_images[‘update’]) == ‘Added’ || $wp_logo_slider_images[‘update’] == ‘Deleted’ || $wp_logo_slider_images[‘update’] == ‘Updated’) { isset($wp_logo_slider_images[‘update’]) is never going to equal ‘Added’ but that isn’t where the error comes in. PHP will try to use $wp_logo_slider_images[‘update’] twice on that line without checking that the value is set. What you need … Read more