Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Page account create by bootstrap and MB Plugin
<?php
/**
* Template Name: My Account
*/
?>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<?php
if ( !is_user_logged_in() ) {
auth_redirect();
}
$current_user = wp_get_current_user();
get_header();
?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="account-tab" data-toggle="tab" href="#account" role="tab" aria-controls="account" aria-selected="true">Account</a>
</li>
<li class="nav-item">
<a class="nav-link" id="Post-tab" data-toggle="tab" href="#Post" role="tab" aria-controls="Post" aria-selected="false">Your Post</a>
</li>
</ul>
<div class="tab-content" id="TabContent">
<div class="tab-pane fade show active" id="account" role="tabpanel" aria-labelledby="account-tab">
<?php
while ( have_posts() ) :
the_post();
the_content();
endwhile; // End of the loop.
?>
</div>
<div class="tab-pane fade" id="Post" role="tabpanel" aria-labelledby="Post-tab">
<p>Your list posts ! Once published, you can no longer edit a post.</p>
<table class="table table-hover table-striped">
<thead>
<tr>
<th>#</th>
<th>Title</th>
<th>Date Created</th>
<th>Status</th>
</tr>
</thead>
<tbody id="postTable">
<?php
$count=0;
$args_post_by_author = array(
'author' => $current_user->ID,
'orderby' => 'post_date',
'order' => 'ASC',
'posts_per_page' => -1,
'post_status' => array('publish', 'pending')
);
$posts_author = get_posts($args_post_by_author);
foreach ($posts_author as $post_author) { $count++; ?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo wp_trim_words( $post_author->post_title, 10, '...'); ?></td>
<td><?php echo $post_author->post_date; ?></td>
<td><?php echo $post_author->post_status; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</main>
</div>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.