Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Template Name: Vendor Products
*/
// File Security Check
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Vendor::no_vendor_redirect();
$config = presscore_config();
$config->set( 'template', 'page' );
get_header();
?>
<div id="content" class="content" role="main">
<?php get_template_part('wc-vendors/dashboard/links'); ?>
<?php
$user = wp_get_current_user();
$args = array(
'author' => $user->ID,
'post_type' => 'product',
'post_status' => array('pending', 'publish')
);
$my_products = get_posts($args);
?>
<table>
<thead>
<tr>
<th>Img</th>
<th>Titolo</th>
<th>Prezzo</th>
<th>Stato</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach($my_products as $p):
$_product = wc_get_product($p->ID);
$_price = $_product->get_price_html();
?>
<tr>
<td>
<a href="<?php bloginfo('url')?>/?p=<?php echo $p->ID; ?>">
<?php echo get_the_post_thumbnail( $p->ID, $size = array(50,50)); ?>
</a>
</td>
<td><?php echo $p->post_title; ?></td>
<td><?php echo $_price; ?></td>
<td><?php echo $p->post_status; ?></td>
<td><a href="<?php bloginfo('url')?>/edit-product?product_id=<?php echo $p->ID; ?>">Modifica</a></td>
<td><a href="<?php bloginfo('url')?>/upload?product_id=<?php echo $p->ID; ?>">Files Allegati</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div><!-- #content -->
<?php do_action( 'presscore_after_content' ) ?>
<?php get_footer() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment