Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Image List Template
- *
- * Description: Twenty Twelve loves the no-sidebar look as much as
- * you do. Use this page template to remove the sidebar from any page.
- *
- * Tip: to remove the sidebar from all posts and pages simply remove
- * any active widgets from the Main Sidebar area, and the sidebar will
- * disappear everywhere.
- *
- * @package WordPress
- * @subpackage Twenty_Twelve
- * @since Twenty Twelve 1.0
- */
- get_header();
- ?>
- <?php
- $or_pid = get_the_ID();
- if(isset($_REQUEST['p_id']) && $_REQUEST['p_id']>0){
- wp_delete_post($_REQUEST['p_id']);
- }
- $user_id = get_current_user_id();
- $qry = 'SELECT * FROM wp_posts WHERE post_type = "post" AND post_author = '.$user_id .' AND post_status != "trash" ORDER BY post_date DESC';
- $res = $wpdb->get_results($qry);
- ?>
- <div class="content_main">
- <div class="left_panel12">
- <ul>
- <li><a href="<?php echo get_permalink('654'); ?>">Post Add</a></li>
- <li><a href="<?php echo get_permalink('672'); ?>">Post List</a></li>
- <li><a href="<?php echo get_permalink('679'); ?>">My Post Rating</a></li>
- <li><a href="<?php echo get_permalink('684'); ?>">My Profile</a></li>
- <li><a href="<?php echo wp_logout_url( home_url()); ?>">Logout</a></li>
- </ul>
- </div>
- <div class="right_panel12">
- <div class="form80">
- <div class="div_tbl">
- <div class="tbl_row hding">
- <div class="tbl_col bold1">S. No.</div>
- <div class="tbl_col bold1">Title</div>
- <div class="tbl_col bold1">Image1</div>
- <div class="tbl_col bold1">Image2</div>
- <div class="tbl_col bold1">tags</div>
- <div class="tbl_col bold1">Action</div>
- </div>
- <?php $i= 1;foreach ( $res as $post ) { setup_postdata( $post );
- $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
- $image_id = get_post_meta( $post->ID, 'custom_featured_image', true );
- $image_attributes = wp_get_attachment_image_src($image_id);
- $t = wp_get_post_tags($post->ID);
- $au = array();
- foreach($t as $tag){
- $au[] = $tag->name;
- }
- ?>
- <div class="tbl_row">
- <div class="tbl_col"><?php echo $i; ?></div>
- <div class="tbl_col"><a class="tit" href="<?php the_permalink(); ?>"><?php echo $post->post_title; ?></a></div>
- <div class="tbl_col"><img alt="<?php echo $post->post_title; ?>" src="<?php echo $url; ?>" width="75px" /></div>
- <div class="tbl_col"><img alt="<?php echo $post->post_title; ?>" src="<?php echo $image_attributes[0]; ?>" width="75px" /></div>
- <div class="tbl_col"><?php echo implode(',',$au); ?></div>
- <div class="tbl_col"><a class="delt" href="<?php echo get_permalink($or_pid); ?>&p_id=<?php echo $post->ID; ?>">Delete</a></div>
- </div>
- <?php $i++;} ?>
- </div>
- </div>
- </div>
- </div>
- <?php get_footer(); ?>
- <style>
- .div_tbl{
- width:100%;
- }
- .div_tbl .tbl_row{
- height: 75px;
- width: 100%;
- float: left;
- }
- .div_tbl .tbl_row .tbl_col{
- width:15%;
- float:left;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement