Skip to content

Instantly share code, notes, and snippets.

@KeylorCR
Created April 5, 2021 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeylorCR/e6060c86286b905d43cd95eb34240e97 to your computer and use it in GitHub Desktop.
Save KeylorCR/e6060c86286b905d43cd95eb34240e97 to your computer and use it in GitHub Desktop.
Archive template for store CPT using the stores ordering configurations from WC Pickup Store settings page.
<?php
/**
** The template for displaying archive store post type
** Current version: 1.5.13
**/
get_header(); ?>
<div id="primary" class="content-area">
<header class="entry-header">
<h1 class="wps-title page-title"><?= post_type_archive_title() ?></h1>
</header><!-- .page-header -->
<main id="main" class="site-main" role="main">
<?php
$args = array(
'post_type' => 'store',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => WPS()->stores_order_by,
'order' => WPS()->stores_order
);
$query = new WP_Query($args);
if ( $query->have_posts() ) :
?>
<div class="archive-store-wrapper">
<?php
while ( $query->have_posts() ) : $query->the_post();
$city = wps_get_post_meta(get_the_ID(), 'city');
$phone = wps_get_post_meta(get_the_ID(), 'phone');
$description = wps_get_post_meta(get_the_ID(), 'description');
?>
<div class="store-box-content">
<?php do_action('wps_before_archive_store_content', get_the_ID()) ?>
<?php if(has_post_thumbnail()) : ?>
<div class="store-image">
<?php the_post_thumbnail('thumbnail') ?>
</div>
<?php endif; ?>
<div class="store-content">
<?php if(!empty($city)) : ?>
<h4><a href="<?php the_permalink() ?>"><?= sanitize_text_field($city) ?></a></h4>
<?php endif; ?>
<?php if(!empty($phone)) : ?>
<p><?= sanitize_text_field($phone) ?></p>
<?php endif; ?>
<?= apply_filters('the_content', $description) ?>
</div>
<?php do_action('wps_after_archive_store_content', get_the_ID()) ?>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<?php else : ?>
<h3><?= __('No stores available', 'wp-pickup-store'); ?></h3>
<?php endif; ?>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
@adrralph
Copy link

Hello, I insert that code in which part?
Sorry I know very little!

@adrralph
Copy link

the order mail is not reaching any of the configured stores

@KeylorCR
Copy link
Author

KeylorCR commented Aug 1, 2022

Hey @adrralph

This is a template that should go to the root of your child theme. Email me in case you need further assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment