Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End append % sign in a variable

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #151893
    dynamyc
    Participant

    I have this php code used for a milestone wordpress shortcode :

        function rocknrolla_milestone_box_shortcode( $atts, $content = null ){
    
        extract( shortcode_atts(array(
            "count" => '500',       
            "title" => ''
        ), $atts) );   
    
        $rnr_milestone_box = '<div class="milestone-counter" data-perc="'. $count .'">';
        $rnr_milestone_box .= '<span class="milestone-count highlight">'. $count .'</span>';
        $rnr_milestone_box .= '<h6 class="milestone-details">'. $title .'</h6>';
        $rnr_milestone_box .= '</div>';
    
        return $rnr_milestone_box;
    
        }
    
           add_shortcode('milestone_box', 'rocknrolla_milestone_box_shortcode');
    

    How can I append the % sign after the count variable here, after the $count variable: $rnr_milestone_box .= '<span class="milestone-count highlight">'. $count .'</span>';

    #151912
    vaielab
    Participant

    Simply output it like a normal text

    $rnr_milestone_box .= '<span class="milestone-count highlight">'. $count .'%</span>';
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.