<div class="tab-container setting-posts-container">
   <div class="row">
      <div class="col-lg-12 table-responsive">
         <h4 class="pull-left"><?php echo $wo['lang']['manage_posts'];?> </h4>
         <div class="clear"></div>
         <table class="table table-hover table-bordered table-condensed">
            <thead>
               <tr>
                  <th><?php echo $wo['lang']['id'];?></th>
                  <th><?php echo $wo['lang']['publisher'];?> </th>
                  <th><?php echo $wo['lang']['post'];?> </th>
                  <th><?php echo $wo['lang']['post_link'];?> </th>
                  <th><?php echo $wo['lang']['time'];?> </th>
                  <th><?php echo $wo['lang']['action'];?></th>
               </tr>
            </thead>
            <tbody class="posts-result manage-posts-list">
               <?php 
               $posts = Wo_GetAllPosts();
                if (count($posts) > 0) {
                  foreach ($posts as $wo['story']) {
                    echo Wo_LoadPage('admin/manage_posts/posts-list');
                  }
                } 
               ?>
            </tbody>
         </table>
         <div class="no-result">
            <?php 
            if (count($posts) == 0) {
              echo '<span class="center-text">' . $wo['lang']['there_are_not_new_posts_for_now'] . '</span>';
            }
            ?>
         </div>
         <?php
         if (count($posts) > 0) { 
         ?>
         <div class="view-more-wrapper view-more-posts-wrapper">
            <span class="text-center" onclick="Wo_AdminGetMorePosts();">
            <i class="fa fa-arrow-down progress-icon" data-icon="search"></i> <?php echo $wo['lang']['show_more_posts'];?>
            </span>
         </div>
         <?php } ?>
         <span class="center-text"></span>
      </div>
   </div>
</div>
<script>
function Wo_AdminDeletePost(post_id) {
    if (confirm("<?php echo $wo['lang']['post_delete_confirmation'];?>") == false) {
      return false;
    }
    var delete_icon = $('.manage-posts-list').find('#PostID_' + post_id).find('.delete-post');
    Wo_progressIconLoader(delete_icon);
    $.post(Wo_Ajax_Requests_File() + '?f=admin_setting&s=delete_post', {post_id:post_id}, function(data) {
      if (data.status == 200) {
        $('#PostID_' + post_id).fadeOut(300, function() {
          $(this).remove();
        });
      }
    });
}

function Wo_AdminGetMorePosts() {
    after_post_id = $('.manage-posts-list').find('.setting-postlist:last').attr('data-post-id');
    view_more_wrapper = $('.view-more-posts-wrapper');
    Wo_progressIconLoader(view_more_wrapper.find('.text-center'));
    $.get(Wo_Ajax_Requests_File() + '?f=admin_setting&s=get_more_posts', {after_post_id:after_post_id}, function(data) {
      if (data.html.length != 0) {
        $('tbody.posts-result').append(data.html);
      } else {
        view_more_wrapper.text("<?php echo $wo['lang']['no_more_posts'];?>");
        view_more_wrapper.delay(1000).slideUp(200);
      }
      Wo_progressIconLoader(view_more_wrapper.find('.text-center'));
    });
}
</script>