snipt

Ctrl+h for KB shortcuts

PHP

WordPress category featured image

1
2
3
4
<?php 
$category = get_the_category(); 
echo '<img src="'. get_bloginfo('template_directory') .'/file/path/'. $category[0]->cat_name .'.png">';
?>
https://snipt.net/embed/b429e591dd15cae818c14e53f042f2ef/
/raw/b429e591dd15cae818c14e53f042f2ef/
b429e591dd15cae818c14e53f042f2ef
php
PHP
4
2019-08-21T20:46:29
True
False
False
/api/public/snipt/38652/
wordpress-category-featured-image
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><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 class="nv">$category</span> <span class="o">=</span> <span class="nx">get_the_category</span><span class="p">();</span> </span><span id="L-3"><a name="L-3"></a><span class="k">echo</span> <span class="s1">&#39;&lt;img src=&quot;&#39;</span><span class="o">.</span> <span class="nx">get_bloginfo</span><span class="p">(</span><span class="s1">&#39;template_directory&#39;</span><span class="p">)</span> <span class="o">.</span><span class="s1">&#39;/file/path/&#39;</span><span class="o">.</span> <span class="nv">$category</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">-&gt;</span><span class="na">cat_name</span> <span class="o">.</span><span class="s1">&#39;.png&quot;&gt;&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
wordpress

Text only

Hide Text

1
2
3
4
5
#replace {
    text-indent: 100%;
    white-space: nowrap;
    overflow: hidden;
}
https://snipt.net/embed/9284085b2c6571a33f58244ec43e60d1/
/raw/9284085b2c6571a33f58244ec43e60d1/
9284085b2c6571a33f58244ec43e60d1
text
Text only
5
2019-08-21T20:46:47
True
False
False
/api/public/snipt/38651/
hide-text-1
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>#replace { </span><span id="L-2"><a name="L-2"></a> text-indent: 100%; </span><span id="L-3"><a name="L-3"></a> white-space: nowrap; </span><span id="L-4"><a name="L-4"></a> overflow: hidden; </span><span id="L-5"><a name="L-5"></a>} </span></pre></div> </td></tr></table>
image, replacement