Show number of conversions in frontend [Hustle Pro]

Hey everyone,

we use a hustle pro emded to collect subscribers. In the backend it shows me the current number of conversions. But is there a chance to show this number also in the frontend? For example: XX users subscriped so far or in an better looking progess bar: XX from ZZ

Maybe you know an easy way to implementate it in an quick and easy way.

Thanks and have a nice day. :v:

Greetings
Philipp

  • Katya Tsihotska

    Hi Philipp

    Hope you're having a great day :slight_smile:

    Since this is dealing with more advanced coding topics, I'm going to ping our SLS Team (code experts) to get their valuable feedback on this question. If it's something that we can easily customize for you, they will help you to do this. One of our SLS members will reply back here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Kind regards,
    Katya

  • Konstantinos Xenos

    Hey Philipp !

    I made a simple shortcode for you to use wherever you like in the front end.

    You can copy and paste the code from the end of this reply into your functions.php. You can also change the 'users subscribed so far!', 'conversions so far!', and translation domain into anything you like by editing this snippet.

    When that's done you'll be able to use [hp-show-subscribers id="1" type="subscribers"] or [hp-show-subscribers id="1" type="conversions"] depending on what you want to show from a list. To find the ID just edit your Embed and check your URL for an id=NUMBER ( you'll want the number from this, see attached screenshot ).

    Tell me if this works for you!

    Regards,
    Konstantinos

    /**
     * Hustle Pro Show My Subscribers Shortcode
     *
     * Usage example:
     * [hp-show-subscribers id="1" type="subscribers"]
     * [hp-show-subscribers id="1" type="conversions"]
     *
     */
    function hp_show_my_subs( $atts ) {
    
    	if ( empty( $atts['id'] ) ) {
    		return esc_html( 'Please provide an ID', 'my-domain' );
    	} else {
    		$id = intval( $atts['id'] );
    	}
    
    	if ( empty( $atts['type'] ) ) {
    		return esc_html( 'Please provide a type ( subscribers or conversions ).', 'my-domain' );
    	} else {
    		$type = sanitize_text_field( $atts['type'] );
    	}
    
    	$module      = Hustle_Module_Model::instance()->get( $id );
    	$conversions = null;
    
    	if ( 'subscribers' === $type ) {
    		$subscriptions = $module->get_local_subscriptions();
    		return count( $subscriptions ) . ' ' . esc_html( 'users subscribed so far!', 'my-domain' );
    	} elseif ( 'conversions' === $type ) {
    		$types = $module->get_embedded_types();
    		foreach ( $types as $type ) {
    			$conversions = $conversions + $module->get_statistics( $type )->conversions_count;
    		}
    		return $conversions . ' ' . esc_html( 'conversions so far!', 'my-domain' );
    	} else {
    		return esc_html( 'Invalid arguments.', 'my-domain' );
    	}
    
    }
    add_shortcode( 'hp-show-subscribers', 'hp_show_my_subs' );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.