HEX
Server: Apache
System: Linux wyse1.wyseservers.com 4.18.0-553.124.4.el8_10.x86_64 #1 SMP Fri May 15 04:14:14 EDT 2026 x86_64
User: kochikidswysewor (1061)
PHP: 8.3.33
Disabled: NONE
Upload Files
File: /home/kochikidswysewor/www/wp-content/themes/children-charity-child/shortcodes/ourchildren.php
<?php function ourchildrencontent( $atts ) {
	wp_reset_query();
  $page = 1;
  if ( get_query_var('paged') ) $page = get_query_var('paged');
  if ( get_query_var('page') ) $page = get_query_var('page');
  if($_REQUEST['paged']) $page = $_REQUEST['paged'];
  $children=query_posts( '&post_type=children&orderby=menu_order&order=ASC&showposts=-1');  //print_r($children); 
  $row            = 0;
  $rvs_per_page   = 100; // How many reviews to display on each page
  $testimonials    = $children;
  $total          = count( $children );
  $pages          = ceil( $total / $rvs_per_page );
  $min            = ( ( $page * $rvs_per_page ) - $rvs_per_page ) + 1;
  $max            = ( $min + $rvs_per_page ) - 1;
	$chld_html="";
        	$chld_html .='
          <section class="our-children">
             <div class="container">
                  <div class="row alignH-cente">'; 
                   if(count($children) > 0) {
                    foreach ($children as $child) {
                       $ID = $child->ID;
                       $child_name = get_the_title($ID);
                       $age = get_field('age',$ID);
                       $row++;
                       // Ignore this image if $row is lower than $min
                      if($row < $min) { continue; }
                       // Stop loop completely if $row is higher than $max
                      if($row > $max) { break; }
                       $image = get_the_post_thumbnail($ID,'child_image_cr');
                         if($image){
                            $image =$image;
                         }else{
                            $image.='<img width="250" height="250" src="'. get_stylesheet_directory_uri() .'/img/default.jpg" class="full-width wp-post-image" alt="'.$child_name.' ('.$age.' yrs)" title="'.$child_name.' ('.$age.' yrs)">';
                         }
                       $chld_html .='
                       <div class="col-lg-3 col-md-3 col-sm-6">
                            <div class="kidsWrap">
                                 <figure class="kid-pc">
                                      <a href="'.get_permalink($ID).'">'.$image.'</a>
                                 </figure>
                                 <p><strong><a href="'.get_permalink($ID).'">'.$child_name.' ('.$age.' year)</a></strong></p>
                            </div>
                       </div>';
                    } }
                    $pagination = paginate_links( array(
                    'base' => get_permalink() . 'page/%#%' . '/',
                    'format' => '?page=%#%',
                    'prev_next'          => true,
                    'prev_text'          => __('Prev'),
                    'next_text'          => __('Next'),
                    'current' => $page,
                    'total' => $pages,
                    'type'  => 'array'
                    ) );
                    if( is_array( $pagination ) ) { 
                    $chld_html .='
                    <div class="navigation"><ol class="wp-paginate font-inherit">';
                     foreach ( $pagination as $page_ ) {
                        $pagina_ =  str_replace("page-numbers", "page", $page_);
                      $chld_html .='
                    <li>'.$pagina_.'</li>';

                     } 
                     $chld_html .='
                    </ol></div>';

                     }
                  $chld_html .=' 
                  </div>
             </div>
        </section>';
	return $chld_html;
}add_shortcode('ourchildrencontent','ourchildrencontent');
?>