• Resolved SnapCase

    (@snapcase)


    Hi,

    I’d like to add a percentage sign to the digit shown in the feature bullets of the About Section. It seems only to be able to handle a plain number, which makes it very unclear to our visitors what that number actually means.

    Adding a % sign would help, better would be to be able to add HTML and set the progress bar manually, but that might be to much to ask on short term.

    Could you tell me how to do that? I tried changing the ‘type’ in customize.php from number to text or string, but that didn’t help ;).

    Grt, Kevin

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,

    You don’t need a type for this. Just remove the type line, and change from:

    sanitize_callback' => 'zerif_sanitize_number'

    to:

    'sanitize_callback' => 'sanitize_text_field'

    Regards,
    Hardeep

    Thread Starter SnapCase

    (@snapcase)

    $wp_customize->add_setting( 'zerif_aboutus_feature1_nr', array('sanitize_callback' => 'sanitize_text_field','default' => '50'));
    
    		$wp_customize->add_control(
    
    			new Zerif_Customizer_Number_Control(
    
    				$wp_customize,
    
    				'zerif_aboutus_feature1_nr',
    
    				array(
    
    					'label' => __( 'Feature no1 percentage', 'zerif' ),
    
    					'section' => 'zerif_aboutus_feature1_section',
    
    					'settings' => 'zerif_aboutus_feature1_nr',
    
    					'priority'    => 3
    
    				)
    
    			)
    
    		);

    Unfortunately that didn’t work. Whenever I enter anything else than a digit the ‘circle’ is not shown at all.

    Hi,

    Try this code:

    $wp_customize->add_setting( 'zerif_aboutus_feature1_nr', array('sanitize_callback' => 'sanitize_text_field','default' => '50'));
    
    		$wp_customize->add_control(
    
    				$wp_customize,
    
    				'zerif_aboutus_feature1_nr',
    
    				array(
    
    					'label' => __( 'Feature no1 percentage', 'zerif' ),
    
    					'section' => 'zerif_aboutus_feature1_section',
    
    					'settings' => 'zerif_aboutus_feature1_nr',
    
    					'priority'    => 3
    
    				)
    
    		);
    Thread Starter SnapCase

    (@snapcase)

    Causes these notices:
    Warning: Illegal offset type in isset or empty in /Applications/XAMPP/xamppfiles/htdocs/socialboosters/wp-includes/class-wp-customize-manager.php on line 722

    Warning: Illegal offset type in /Applications/XAMPP/xamppfiles/htdocs/socialboosters/wp-includes/class-wp-customize-manager.php on line 840

    Hi,

    Let’s give it one last try:

    $wp_customize->add_setting( 'zerif_aboutus_feature1_nr', array('sanitize_callback' => 'sanitize_text_field','capability' => 'edit_theme_options',));
    
            $wp_customize->add_control(
    
                    'zerif_aboutus_feature1_nr',
    
                    array(
    
                        'label' => __( 'Feature no1 percentage', 'zerif' ),
    
                        'section' => 'zerif_aboutus_feature1_section',
    
                        'settings' => 'zerif_aboutus_feature1_nr',
    
                        'priority'    => 3
    
                    ));

    Last code had $wp_customize which was causing this error. :p

    Thread Starter SnapCase

    (@snapcase)

    Thanks! Works!

    Hi,

    I’m glad it worked. Don’t forget to review the theme if you like it. 🙂

    Regards,
    Hardeep

    What do the % even mean in about us to the viewer of the site — am I missing something?

    What do the % even mean in about us to the viewer of the site — am I missing something?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add % to About Us features’ is closed to new replies.