Replace Page Numbers with Letters

Code

Filename: gw-replace-page-numbers-with-letters.php

<?php
/**
 * Gravity Wiz // Gravity Forms // Replace Page Numbers with Letters
 * https://gravitywiz.com/
 */
add_filter( 'gform_progress_steps', function( $markup, $form ) {
	preg_match_all( '/<span class='gf_step_number.*?'>(d+)</span>/', $markup, $matches );
	foreach ( $matches[1] as $index => $value ) {
		$search  = $matches[0][ $index ];
		$replace = str_replace( $value, chr( 64 + $value ), $search );
		$markup  = str_replace( $search, $replace, $markup );
	}
	return $markup;
}, 10, 2 );

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.