WooCommerce Custom Pagination

Can anybody help me with a situation I have on my custom archive-product.php?

I am trying to add pagination to my grid I have made but do not know where to start. This is the code for my products:

<?php $the_query = new WP_Query( array(
   'posts_per_page'=>12,
   'post_type'=>'product',
   'paged' => get_query_var('paged') ? get_query_var('paged') : 1)
   ); 
?>

<div class="container marginT10P">
    <div id="products" class="row view-group">
        <?php $query = new WP_Query( $args );
            if ( $the_query->have_posts() ) {
            global $wpdb;
            while ( $the_query->have_posts() ) : $the_query->the_post();
            $image = wp_get_attachment_image_src( get_post_thumbnail_id( $the_query->post->ID ), 'single-post-thumbnail' );
        ?>

  <div class="item col-xs-4 col-md-6 col-lg-4">
    <div class="thumbnail card">
      <div class="img-event">
        <a href="<?php the_permalink(); ?>"><img class="group list-group-image img-fluid propertysize" src="<?php echo $image[0]; ?>" alt="<?php get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ); ?>" alt="" /></a>
    </div>
    <div class="caption card-body">
        <?php global $woocommerce;
            $currency = get_woocommerce_currency_symbol();
            $price = get_post_meta( get_the_ID(), '_regular_price', true); 
        ?>
        <h4 class="group card-title inner list-group-item-heading text-grey"><?php echo $currency; echo $price; ?> pcm</h4>
        <i class="fa fa-bath"></i> <?php echo $product->get_attribute( 'bathrooms' ); ?>
        <div class="icon-marginL10"><i class="fa fa-bed"></i> <?php echo $product->get_attribute( 'bedrooms' ); ?></div>
        <div class="icon-marginL10"><i class="fa fa-couch"></i> <?php echo $product->get_attribute( 'lounges' ); ?></div>
        <p class="group inner list-group-item-text bold no-margin font-size14 text-grey"><?php the_title(); ?></p>
        <p class="group inner list-group-item-text font-size14"><?php echo get_post_meta( get_the_ID(), 'grid-description', true ); ?></p>
        <div class="row">
            <div class="col-xs-12 col-md-6 col-lg-6 text-left tabletL-margin">
                <a class="btn btn-primary padding40 bold" href="<?php the_permalink(); ?>">Full Details</a>
            </div>
            <div class="col-xs-12 col-md-6 col-lg-6 text-right">
                <a class="btn btn-success padding20 bold" href="<?php echo esc_url( home_url( '/request-call-back' ) ); ?>">Arrange To View</a>
            </div>
        </div>
    </div>
    <div class="img-event">
        <a class="btn btn-danger padding40 width100 bold" href="tel:01472222333">Call 01472 222333</a>  
    </div>
</div>
</div>
  <?php endwhile;
    } else {
      echo __( 'No products found' );
    }
  ?>
</div>
</div>

sorry for the messy code I will optimise it when it’s complete

$299 Affordable Web Design WordPress

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

WooCommerce Custom Pagination

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.