snipt

Ctrl+h for KB shortcuts

PHP

Wordpress query Join for post - taxonomy - term

$sql="SELECT DISTINCT * FROM wp_posts INNER JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) INNER JOIN wp_terms ON(wp_term_taxonomy.term_id = wp_terms.term_id) WHERE (wp_terms.name LIKE '% {$search_keyword}%' OR wp_terms.name LIKE '{$search_keyword}%' OR wp_posts.post_title LIKE '% {$search_keyword}%' OR wp_posts.post_title LIKE '{$search_keyword}%') AND wp_posts.post_status='publish'";
$search_products = $wpdb->get_results($sql, OBJECT);
https://snipt.net/embed/424bc93629689d496b8b27c8c5748a06/
/raw/424bc93629689d496b8b27c8c5748a06/
424bc93629689d496b8b27c8c5748a06
php
PHP
2
2019-08-21T11:39:22
True
False
False
Jan 27, 2013 at 08:04 AM
/api/public/snipt/54584/
wordpress-query-join-for-post-taxonomy-term
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">$sql=&quot;SELECT DISTINCT * FROM wp_posts INNER JOIN wp_term_relationships ON(wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) INNER JOIN wp_terms ON(wp_term_taxonomy.term_id = wp_terms.term_id) WHERE (wp_terms.name LIKE &#39;% {$search_keyword}%&#39; OR wp_terms.name LIKE &#39;{$search_keyword}%&#39; OR wp_posts.post_title LIKE &#39;% {$search_keyword}%&#39; OR wp_posts.post_title LIKE &#39;{$search_keyword}%&#39;) AND wp_posts.post_status=&#39;publish&#39;&quot;;</span> </span><span id="L-2"><a name="L-2"></a><span class="x">$search_products = $wpdb-&gt;get_results($sql, OBJECT);</span> </span></pre></div> </td></tr></table>
join, mysql, posts, query, taxonomy, wordpress

PHP

Magento - if language is....

1
2
3
4
5
6
7
public function getPayWayLocale() {
  $loc = substr(Mage::app()->getLocale()->getLocaleCode(), 3, 2);
  if($loc != 'HR' && $loc != 'EN' && $loc != 'DE' && $loc != 'IT' && $loc != 'FR') {
   $loc = '';
  }
  return $loc;
 }
https://snipt.net/embed/436539320bf2b96055457d8200b89ef1/
/raw/436539320bf2b96055457d8200b89ef1/
436539320bf2b96055457d8200b89ef1
php
PHP
7
2019-08-24T05:40:38
True
False
False
/api/public/snipt/52655/
magento-if-language-is
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">public function getPayWayLocale() {</span> </span><span id="L-2"><a name="L-2"></a><span class="x"> $loc = substr(Mage::app()-&gt;getLocale()-&gt;getLocaleCode(), 3, 2);</span> </span><span id="L-3"><a name="L-3"></a><span class="x"> if($loc != &#39;HR&#39; &amp;&amp; $loc != &#39;EN&#39; &amp;&amp; $loc != &#39;DE&#39; &amp;&amp; $loc != &#39;IT&#39; &amp;&amp; $loc != &#39;FR&#39;) {</span> </span><span id="L-4"><a name="L-4"></a><span class="x"> $loc = &#39;&#39;;</span> </span><span id="L-5"><a name="L-5"></a><span class="x"> }</span> </span><span id="L-6"><a name="L-6"></a><span class="x"> return $loc;</span> </span><span id="L-7"><a name="L-7"></a><span class="x"> }</span> </span></pre></div> </td></tr></table>

HTML

Lock the layout's resolution to a 1:1 ratio so that each pixel exactly lines up with the pixels in the iPad's screen.

<meta name="viewport" content="width=768px, minimum-scale=1.0, maximum-scale=1.0" />
https://snipt.net/embed/72b2329ba95806f00012979169d12492/
/raw/72b2329ba95806f00012979169d12492/
72b2329ba95806f00012979169d12492
html
HTML
1
2019-08-25T16:58:42
True
False
False
/api/public/snipt/42492/
lock-the-layouts-resolution-to-a-11-ratio-so-that-each-pixel-exactly-lines-up-with-the-pixels-in-the-ipads-screen
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;width=768px, minimum-scale=1.0, maximum-scale=1.0&quot;</span> <span class="p">/&gt;</span> </span></pre></div> </td></tr></table>
ipad, layout, meta, screen