Using TCP Loops

TheCartPress takes advantage of the functionality of WordPress loops.

The Loop is used by WordPress to display each of your posts. Using The Loop, WordPress processes each of the posts/products to be displayed on the current page and formats them according to how they match specified criteria within The Loop tags. Any HTML or PHP code placed in the Loop will be repeated on each post. When WordPress documentation states “This tag must be within The Loop”, such as for specific Template Tag or plugins, the tag will be repeated for each post.

For beginners look at The Loop, see The Loop in Action.

Once integrated your Tcp loops in your theme, you can use the loops from your templates, widgets and shortcodes to list products in grid mode.

Integrating the configurable Tcp Loops in your theme

When working with configurable TCP-loops, you can set from the backend (TheCartPress> Loop settings) the appearance of the TCP-loop you call from your templates.
At this point you can only have one setting for all the Tcp loops you’re using called directly from your templates.
Through widgets and shortcodes you can have as many configurations as you’re using.

Therefore we recommend for the moment that you use in your product archive templates a Tcp configurable loop and in your single product page a non Tcp configurable loop if your needs are different in, typical case.

Now we are going to integrate the configurable Tcp Loop (loop-tcp-grid.php) to display products in configurable grid format in your theme.

  • Paste loop-tcp-grid.phpdirectly in your theme (you have the file in /thecartpress/themes-templates/).
    • Once pasted loop-tcp-grid.php in your theme, open loop-tcp-grid.php, probably you need to adapt css classes to fit closely to your active theme. Customize your css classes as you need.
  • Call the loops from your store templates, widgets and shortcodes.