Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

Text only

Magento One Page Checkout By FME


https://snipt.net/embed/7bb93a20ae5e09b274e64115ad03fcc4/
https://snipt.net/raw/7bb93a20ae5e09b274e64115ad03fcc4/
7bb93a20ae5e09b274e64115ad03fcc4
text
Text only
1
2016-12-07T08:57:29
True
False
False
Aug 13, 2013 at 08:11 AM
/api/public/snipt/73884/
magento-one-page-checkout-by-fme
<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></pre></div> </td></tr></table>
"one step", Magento, checkout, extension, page

PHP

PHP: Redirect page

1
2
3
4
5
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: howareyou.php");
exit();
?>
https://snipt.net/embed/df1029b5984d7be9e3d79c678e3e3e0a/
https://snipt.net/raw/df1029b5984d7be9e3d79c678e3e3e0a/
df1029b5984d7be9e3d79c678e3e3e0a
php
PHP
5
2016-12-06T07:14:59
True
False
False
Jan 18, 2013 at 09:24 AM
/api/public/snipt/53971/
php-redirect-page
<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><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;HTTP/1.1 301 Moved Permanently&quot;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nb">header</span><span class="p">(</span><span class="s2">&quot;Location: howareyou.php&quot;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="k">exit</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
301, page, php, redirect

PHP

Get specific page teaser in Wordpress (text before more tag)

1
2
3
4
5
6
7
<?php
$page_id = 5824;
$page_data = get_page( $page_id );
$exploded = explode("<!--more-->",$page_data->post_content);
$the_content = apply_filters('the_content',$exploded[0]);
echo $the_content;
?>
https://snipt.net/embed/465105f49273b0b46ee827a346b88219/
https://snipt.net/raw/465105f49273b0b46ee827a346b88219/
465105f49273b0b46ee827a346b88219
php
PHP
7
2016-11-25T20:55:24
True
False
True
Jan 16, 2013 at 09:13 PM
/api/public/snipt/53861/
get-specific-page-teaser-in-wordpress-text-before-more-tag
<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="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$page_id</span> <span class="o">=</span> <span class="mi">5824</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a><span class="nv">$page_data</span> <span class="o">=</span> <span class="nx">get_page</span><span class="p">(</span> <span class="nv">$page_id</span> <span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$exploded</span> <span class="o">=</span> <span class="nb">explode</span><span class="p">(</span><span class="s2">&quot;&lt;!--more--&gt;&quot;</span><span class="p">,</span><span class="nv">$page_data</span><span class="o">-&gt;</span><span class="na">post_content</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$the_content</span> <span class="o">=</span> <span class="nx">apply_filters</span><span class="p">(</span><span class="s1">&#39;the_content&#39;</span><span class="p">,</span><span class="nv">$exploded</span><span class="p">[</span><span class="mi">0</span><span class="p">]);</span> </span><span id="L-6"><a name="L-6"></a><span class="k">echo</span> <span class="nv">$the_content</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
functions.php, page, wordpress

PHP

Wordpress: Loop de noticias en cualquier página

1
2
3
4
5
6
7
<?php $my_query = "showposts=3&cat=5"; $my_query = new WP_Query($my_query); ?>
<?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>

<!-- Insert the regular template tags you would use within the loop here-->

<?php endwhile; // end of one post ?>
<?php endif; //end of loop ?>
https://snipt.net/embed/3ba26c1cda152acfa41538d560851ae8/
https://snipt.net/raw/3ba26c1cda152acfa41538d560851ae8/
3ba26c1cda152acfa41538d560851ae8
php
PHP
7
2016-12-04T23:53:49
True
False
False
Sep 20, 2012 at 03:38 PM
/api/public/snipt/45027/
wordpress-loop-de-noticias-en-cualquier-pagina
<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="cp">&lt;?php</span> <span class="nv">$my_query</span> <span class="o">=</span> <span class="s2">&quot;showposts=3&amp;cat=5&quot;</span><span class="p">;</span> <span class="nv">$my_query</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">WP_Query</span><span class="p">(</span><span class="nv">$my_query</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="cp">&lt;?php</span> <span class="k">if</span> <span class="p">(</span><span class="nv">$my_query</span><span class="o">-&gt;</span><span class="na">have_posts</span><span class="p">())</span> <span class="o">:</span> <span class="k">while</span> <span class="p">(</span><span class="nv">$my_query</span><span class="o">-&gt;</span><span class="na">have_posts</span><span class="p">())</span> <span class="o">:</span> <span class="nv">$my_query</span><span class="o">-&gt;</span><span class="na">the_post</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="x">&lt;!-- Insert the regular template tags you would use within the loop here--&gt;</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a><span class="cp">&lt;?php</span> <span class="k">endwhile</span><span class="p">;</span> <span class="c1">// end of one post ?&gt;</span> </span><span id="L-7"><a name="L-7"></a><span class="o">&lt;?</span><span class="nx">php</span> <span class="k">endif</span><span class="p">;</span> <span class="c1">//end of loop ?&gt;</span> </span></pre></div> </td></tr></table>
loop, page, wordpress

PHP

Imprimir contenido de una página específica en Wordpress

1
2
3
4
<?php $recent = new WP_Query("page_id=nºpage"); while($recent->have_posts()) : $recent->the_post();?>
// bla bla bla
<?php endwhile;?>
<?php wp_reset_query(); ?>
https://snipt.net/embed/84d16168e1c3fe90a3b9823f76baf248/
https://snipt.net/raw/84d16168e1c3fe90a3b9823f76baf248/
84d16168e1c3fe90a3b9823f76baf248
php
PHP
4
2016-12-02T14:45:00
True
False
False
Dec 21, 2012 at 01:55 PM
/api/public/snipt/41355/
imprimir-contenido-de-una-pagina-especifica-en-wordpress
<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 class="nv">$recent</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">WP_Query</span><span class="p">(</span><span class="s2">&quot;page_id=nºpage&quot;</span><span class="p">);</span> <span class="k">while</span><span class="p">(</span><span class="nv">$recent</span><span class="o">-&gt;</span><span class="na">have_posts</span><span class="p">())</span> <span class="o">:</span> <span class="nv">$recent</span><span class="o">-&gt;</span><span class="na">the_post</span><span class="p">();</span><span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-2"><a name="L-2"></a><span class="x">// bla bla bla</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">&lt;?php</span> <span class="k">endwhile</span><span class="p">;</span><span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-4"><a name="L-4"></a><span class="cp">&lt;?php</span> <span class="nx">wp_reset_query</span><span class="p">();</span> <span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
loop, page, php, wordpress
Copyrighted, illegal, or inappropriate content? Email [email protected].