How to add the values of a wordpress function

0

how can I add the values of a function.

This this function

<?php numero_deposts(); ?>

gives me the post number of certain tags.

Example: 2 4 1 3 ....

but only shows me this way 2413 ....

There is some way to add 2 + 4 + 1 + 3 = 10

here the function:

function numero_deposts(){ 

 $per_page = '9999999';
                                    $sortby = isset($_GET['sortby']) ? $_GET['sortby'] : null;
                                    $page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;


                                    $offset = ( $page -1 ) * $per_page;
                                    $args = array( 'number' => $per_page,  
                                        'offset' => $offset,
                                        'exclude'       => array(), 
                                        'exclude_tree'  => array(), 
                                        'include'       => array(),
                                        'fields'        => 'all', 
                                        'hierarchical'  => true, 
                                        'child_of'      => 0, 
                                        'hide_empty' => 0,
                                        'pad_counts'    => false,
                                        //'terms'     =>  $term->slug,
                                        'cache_domain'  => 'core' );
                                    $taxonomy = 'animales';

                                    $tax_terms = get_terms( $taxonomy, $args );
                                    $total_terms = wp_count_terms( $taxonomy, $offset );


                                  foreach ($tax_terms as $tag) :

                                    $flag = 0; 
                                    if( $sortby == substr( $tag->name, 0, 1 ) || $sortby=='' ) {    $flag = 1;} 
                                    if ($flag=='1'){ 
                                        echo $tag->count;

                                    } 

                                  endforeach;
}
    
asked by Mayli Mendes 04.12.2017 в 06:45
source

0 answers