snipt

Ctrl+h for KB shortcuts
Notice: Snipt is moving away from free accounts on May 1st, 2014. Read more about the transition here.
#43423

PHP

Control number of columns in Woocommerce catalog

1
2
3
4
5
6
7
8
<?php 

//Just put it in functions.php

/* Number of columns in Woocommerce Loop */

global $woocommerce_loop;
$woocommerce_loop['columns'] = 2;
https://snipt.net/embed/7624e6a18a62988fa9e8b4afe3fcfb5a/
https://snipt.net/raw/7624e6a18a62988fa9e8b4afe3fcfb5a/
7624e6a18a62988fa9e8b4afe3fcfb5a
php
PHP
8
2014-04-23T06:32:44
True
False
/api/public/snipt/43423/
control-number-of-columns-in-woocommerce-catalog
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c1">//Just put it in functions.php</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="cm">/* Number of columns in Woocommerce Loop */</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="k">global</span> <span class="nv">$woocommerce_loop</span><span class="p">;</span> </span><span id="L-8"><a name="L-8"></a><span class="nv">$woocommerce_loop</span><span class="p">[</span><span class="s1">&#39;columns&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> </span></pre></div> </td></tr></table>
woocommerce, wordpress