snipt

Ctrl+h for KB shortcuts

PHP

Agregar clase a la primera palabra del título de un widget

1
2
3
4
5
6
7
8
<?php
// Adds <span></span> around the first word of Widget titles
function arixWP_widget_title($title) {
$title = preg_replace('/(^[A-z0-9_]+)\s/i', '<span>$1</span> ', $title);
return $title;
}
add_filter('widget_title', 'arixWP_widget_title');
?>
https://snipt.net/embed/b867a1fb2ddab33cb3ac037679c9e9db/
https://snipt.net/raw/b867a1fb2ddab33cb3ac037679c9e9db/
b867a1fb2ddab33cb3ac037679c9e9db
php
PHP
8
2016-09-26T03:05:04
True
False
False
Aug 17, 2012 at 01:43 PM
/api/public/snipt/45871/
agregar-clase-a-la-primera-palabra-del-titulo-de-un-widget
<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 class="c1">// Adds &lt;span&gt;&lt;/span&gt; around the first word of Widget titles</span> </span><span id="L-3"><a name="L-3"></a><span class="k">function</span> <span class="nf">arixWP_widget_title</span><span class="p">(</span><span class="nv">$title</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$title</span> <span class="o">=</span> <span class="nb">preg_replace</span><span class="p">(</span><span class="s1">&#39;/(^[A-z0-9_]+)\s/i&#39;</span><span class="p">,</span> <span class="s1">&#39;&lt;span&gt;$1&lt;/span&gt; &#39;</span><span class="p">,</span> <span class="nv">$title</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="k">return</span> <span class="nv">$title</span><span class="p">;</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="nx">add_filter</span><span class="p">(</span><span class="s1">&#39;widget_title&#39;</span><span class="p">,</span> <span class="s1">&#39;arixWP_widget_title&#39;</span><span class="p">);</span> </span><span id="L-8"><a name="L-8"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
clase, sidebar, widget

CSS

Adaptive sizing for FB Widgets

1
2
3
4
.fb-like-box, .fb-like-box span, .fb-like-box.fb_iframe_widget span iframe,
.fb-comments, .fb-comments span, .fb-comments.fb_iframe_widget span iframe {
    width: 100% !important;
}
https://snipt.net/embed/17b2705133bff79474e5f8bd3b2462dc/
https://snipt.net/raw/17b2705133bff79474e5f8bd3b2462dc/
17b2705133bff79474e5f8bd3b2462dc
css
CSS
4
2016-09-28T17:44:25
True
False
False
/api/public/snipt/41179/
adaptive-sizing-for-fb-widgets
<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 id="L-1"><a name="L-1"></a><span class="nc">.fb-like-box</span><span class="o">,</span> <span class="nc">.fb-like-box</span> <span class="nt">span</span><span class="o">,</span> <span class="nc">.fb-like-box.fb_iframe_widget</span> <span class="nt">span</span> <span class="nt">iframe</span><span class="o">,</span> </span><span id="L-2"><a name="L-2"></a><span class="nc">.fb-comments</span><span class="o">,</span> <span class="nc">.fb-comments</span> <span class="nt">span</span><span class="o">,</span> <span class="nc">.fb-comments.fb_iframe_widget</span> <span class="nt">span</span> <span class="nt">iframe</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="k">width</span><span class="o">:</span> <span class="m">100%</span> <span class="cp">!important</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
FB, Facebook, adaptive, comments, like-box, responsive, widget
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.