WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wish to change the default ajax loader for gravity forms. I have done this using the following code (link found here):

add_filter( 'gform_ajax_spinner_url', 'cwwp_custom_gforms_spinner' );

   * Changes the default Gravity Forms AJAX spinner.
   * @since 1.0.0
   * @param string $src The default spinner URL
   * @return string $src The new spinner URL

    function cwwp_custom_gforms_spinner( $src ) {

    return get_stylesheet_directory_uri() . '/assets/img/css/newsletter-loader.gif';


This seems to work fine. What I would like todo is set another custom ajax spinner for a different form on a different page. The design of the page is different and I would like to set a different spinner. Any ideas how I do this?

share|improve this question

closed as off-topic by ialocin, mrwweb, gmazzap, Johannes Pille, birgire Aug 31 '14 at 16:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 1 down vote accepted

Without testing, this should work (still use the add_filter bit):

function cwwp_custom_gforms_spinner( $src ) {
   global $post;
   if( $post->ID == $id ): // use whatever page identifier/conditional you like here: ID, template used, slug etc.
   // other identifiers would probably be better and won't rely on global $post
   // for example is_front_page(), is_archive(), etc
      return get_stylesheet_directory_uri() . 'path/to/spinner/1.gif';
      return get_stylesheet_directory_uri() . 'path/to/spinner/2.gif';
share|improve this answer
Worked great! Thanks very much. – Shane Griffiths Feb 20 '13 at 14:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.