<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>techNerdia - Web Development Tips</title> <atom:link href="http://technerdia.com/feed" rel="self" type="application/rss+xml" /><link>http://technerdia.com</link> <description>Web Development Tips, Tricks and Ideas</description> <lastBuildDate>Tue, 21 Feb 2012 21:08:10 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Add Google Code SyntaxHighlighter to WordPress without using a Plugin</title><link>http://technerdia.com/885_syntaxhighlighter.html</link> <comments>http://technerdia.com/885_syntaxhighlighter.html#comments</comments> <pubDate>Tue, 21 Feb 2012 21:05:51 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Customizing]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[code]]></category> <category><![CDATA[google]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[markup]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wp]]></category> <category><![CDATA[xml]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=885</guid> <description><![CDATA[Instantly transform code/scripts/markup (php, html, css, java, etc) into a readable and downloadable example code.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/885_syntaxhighlighter.html">Add Google Code SyntaxHighlighter to WordPress without using a Plugin</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>The <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3N5bnRheGhpZ2hsaWdodGVyLw==" target=\"_blank\">Google Code SyntaxHighlighter</a> instantly transforms code/scripts/markup (php, html, css, java, etc) into a readable and downloadable example code.</p><p><img
src="http://technerdia.com/files/syntaxhighlighter.jpg" alt="Google Syntax Highlighter Example" width="697" height="179" class="aligncenter" /></p><p><strong>Disclaimer:</strong> <em>If your Website has an active Syntax Highlighter installed on it, then you must replace the old Syntax Highlighter wraps with the style used by the Google SyntaxHighlighter. Otherwise your code examples will break.</em></p><p
class="alignCenter"><strong><em>Keep Current Syntax Highlighter Plugins / Scripts Active Until All Old Examples Have Been Replaced!</em></strong></p><hr
/><h2>Why use the Google SyntaxHighlighter?</h2><p>Because it&#8217;s pretty dang good! Of course, having the source code has massive advantages too. The simplest is not loading more brushes than your site may use. And the funnest, is the ability to customize the look to your desires.</p><p>The SyntaxHighlighter currently Supports: C++, C#, CSS, Delphi, Java, JavaScript, PHP, Python, Ruby, Sql, VB, and XML/HTML markup and code types. [ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3N5bnRheGhpZ2hsaWdodGVyL3dpa2kvTGFuZ3VhZ2Vz" target=\"_blank\">source</a> ]</p><h2>How Does The Google SyntaxHighlighter Work?</h2><p>It uses Javascript to find the HTML Pre tag and parse the &#8216;code&#8217; data within it. The Pre tag contains the type of code being displayed, allowing a filter to be called that translates the code or markup to readable text within the browser rather than rendering it with the Webpage markup.</p><p><strong>Example Pre Tag</strong>:</p><div
class="mycode"><pre name="code" class="html">&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;/* html markup here */&lt;/pre&gt;</pre></div><h2>Adding the SyntaxHighlighter to your WordPress Blog</h2><p>First, <strong><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3N5bnRheGhpZ2hsaWdodGVyL2Rvd25sb2Fkcy9kZXRhaWw/bmFtZT1TeW50YXhIaWdobGlnaHRlcl8xLjUuMS5yYXI=" target=\"_blank\">download the SyntaxHighlighter rar file</a></strong> from Google Code. After you unRAR (<a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy43LXppcC5vcmcv" target=\"_blank\">7zip</a>) the file, finally open the dp.SyntaxHighlighter directory.</p><p>Within the directory will be three sub-folders:</p><ul><li><strong>Scripts</strong>: Core code and brush script files.</li><li><strong>Styles</strong>: The core CSS file.</li><li><strong>Uncompressed</strong>: Ignore</li></ul><h3>Let&#8217;s Get Started&#8230;</h3><p><strong>The CSS File</strong></p><ul><li>Enter the Styles directory, open the SyntaxHighlighter.css file, select all and copy the entire file.</li><li>Open your themes style.css file, paste the SyntaxHighlighter css data into your themes css file. I put this at the bottom of my css files, below the mobile goodies, sprites, etc.</li><li>Save the file and upload it to your WordPress theme directory.</li></ul><p><strong>The Core</strong></p><ul><li>Go back and into the Scripts directory.</li><li>Find the shCore.js file and right click the file and rename it to: SyntaxHighlighter.js</li></li><li>Open the file in Notepad or <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbG9zLWZyZWV3YXJlLmNoL25vdGVwYWQyLmh0bWw=" target=\"_blank\">Notepad2</a> (what I use) or <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL25vdGVwYWQtcGx1cy1wbHVzLm9yZy9kb3dubG9hZC92NS45LjguaHRtbA==" target=\"_blank\">Notepad+</a></li><li>Leave the file open&#8230;.</li></ul><p><strong>The Brushes</strong><br
/> Brushes, is a term (or name) used to identify the highlighter script for a type of code or script being displayed.</p><p>For example, within the Scripts folder is shBrushCSS.js &#8211; This file would be called when displaying a CSS file within the &#8216;pre&#8217; tag.</p><ul><li><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3N5bnRheGhpZ2hsaWdodGVyL3dpa2kvTGFuZ3VhZ2Vz" target=\"_blank\">View All Possible Code Languages That Can Be Called.</a></li></ul><p>Most Websites will use only a few Brushes. techNerdia for example uses these brushes: CSS, Javascript, PHP, XML/HTML and SQL. These are the only loaded brushes, the others have been ignored.</p><ul><li>Open the brush files that you&#8217;ll be using on your Website.</li><li>Select all and copy the contents of one of the brush file.</li><li>Return to the already opened SyntaxHighlighter.js file, scroll to the very bottom (last line) and paste the Brush code in.</li><li>Repeat this for each Brush type that you&#8217;ll be using.</li><li>Save the file when done. Uplaod the SyntaxHighlighter.js file to your Website/Server. I uploaded mine to domain.com/js/</li></ul><p><strong>Note</strong>: The Scripts directory contains a flash file named clipboard.swf. I could not get this feature working, so I&#8217;ve excluded it.</p><h3>Turning on the SyntaxHighlighter</h3><p>With the CSS data and SyntaxHighlighter.js files uploaded, it&#8217;s time to activate the highlighter.</p><p>** <strong>Do Not Disable</strong> Other highlighter Plugins Yet!!!</p><ul><li>Open your themes footer.php file, scroll to the bottom and find wp_footer().</li><li>Paste the snip below, above the wp_footer() line and above your Google Analytics code, if it&#8217;s in the footer.</li><li>Adjust the URL to the SyntaxHighlighter.js file, save the file, and upload to your theme or /js directory.</li></ul><div
class="mycode"><pre name="code" class="php">
&lt;?php if( is_singular() ){
&lt;script language=&quot;javascript&quot; src=&quot;http://domain.com/js/SyntaxHighlighter.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot;&gt;
	dp.SyntaxHighlighter.HighlightAll(&#39;code&#39;);
&lt;/script&gt;
} ?&gt;
</pre></div><h3>Test the SyntaxHighlighter</h3><p>Easy enough&#8230;.</p><ul><li>Go into your WordPress Admin and CLEAR THE CACHE!</li><li>Create a new post, add the snip below to the body of the post, save the post as a draft, and preview it.</li></ul><div
class="mycode"><pre name="code" class="html"><pre name="code" class="html"><b>It's Working!</b></pre></pre></div><p>The class=&#8221;html&#8221; is what tells the script which brush to load. Change it to php, js, css, etc to display different code/markup types.</p><p>If something isn&#8217;t working, then a step is missing: Check the URL to the SyntaxHighlighter.js file, check that the Brushes have been added to the bottom of the file. Make sure the CSS data has been uploaded or added to your root css file. Ensure the footer call is above the wp_footer() line. Clear the caches again. Try a different brush. Try a different browser.</p><h3>Removing What Isn&#8217;t Used</h3><p>It&#8217;s time to find and replace a few things&#8230; with SyntaxHighlighter.js file open:</p><ul><li>Do a find for: <em>copy to clipboard</em></li><li>Remove the <em>copy to clipboard</em> words <strong>only</strong>.</li><li>Do a find for: <em>print</em> it will be within a label, like: label:&#8217;print&#8217;</li><li>Remove the word <em>print</em> <strong>only</strong>.</li></ul><p>The last removal is optional, it&#8217;s the question mark ? that contains the about information. If you remove this, you should give credit some place&#8230;. like making a blog post about the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3N5bnRheGhpZ2hsaWdodGVyLw==" target=\"_blank\">SyntaxHighlighter</a>.</p><ul><li>To remove, do a find for: <em>label:&#8217;?&#8217;</em></li><li>Remove the <em>question mark ?</em> <strong>only</strong>.</li></ul><ul><li>Save your work, re-upload the file and retest.</li></ul><h2>Customizing the Look of the SyntaxHighlighter</h2><p>The Pre tag wrapper for the code has one customization that can be added to it. It&#8217;s a :collapse feature, which closes the code example when the page is loaded, and opening when clicked.</p><p>Example:</p><div
class="mycode"><pre name="code" class="html:collapse">&lt;pre name=&quot;code&quot; class=&quot;html:collapse&quot;&gt;/* html markup here */&lt;/pre&gt;</pre></div><h2>Wrap the Pre Tag Within a Class</h2><p>This isn&#8217;t mandatory to get the code working, but it does help if for some reason the JavaScript brushes do not load, and it makes the code display.</p><p>Add a class called &#8216;mycode&#8217; around the Pre tag of your code, then define it within your themes CSS file.</p><p><strong>Example</strong>:</p><div
class="mycode"><pre name="code" class="html">&lt;div class=&quot;mycode&quot;&gt;&lt;pre name=&quot;code&quot; class=&quot;html&quot;&gt;/* the sample */&lt;/pre&gt;&lt;/div&gt;</pre></div><p><strong>mycode Class</strong>:</p><div
class="mycode"><pre name="code" class="css">
.mycode {
	border-bottom:1px dotted #aaaaaa;
	color:#006400;
	font-size:11px;
	line-height:16px;
	margin: -5px 0 20px 0;
	padding:0;
}
</pre></div><h3>The Main CSS File</h3><p>If the visual display of the code does not match design, then open the CSS file that contains the SyntaxHighlighter CSS data.</p><p><strong>The main wrapper</strong>: .dp-highlighter<br
/> Adjust the background color, typically this color should be different than your body color of your page, to help the code example stand out.</p><p>You may also want to add a line-height, larger than 12px and increase the padding around each line, this helps with readability.</p><p><strong>Example</strong>:</p><div
class="mycode"><pre name="code" class="css">
line-height:22px;
padding:10px 0;
</pre></div><p><strong>Complete</strong>:</p><div
class="mycode"><pre name="code" class="css">
.dp-highlighter {
	background:#ffffff;
	background-color:#ffffff;
	font-family:"Consolas", "Courier New", Courier, mono, serif;
	font-size:12px;
	line-height:22px;
	margin:18px 0 18px 0 !important;
	overflow:auto;
	padding:10px 0;
	width:99%;
}
</pre></div><p><strong>Rounded corners</strong>: Add the CSS below to the .dp-highlighter class.</p><div
class="mycode"><pre name="code" class="css">.dp-highlighter { -moz-border-radius: 9px; -webkit-border-radius: 9px; -khtml-border-radius: 9px; border-radius: 9px; }</pre></div><p><strong>Color Changes</strong>:
If you&#8217;ve adjusted the background color, you&#8217;ll probably want to adjust the other color settings. Do a find for the classes below, and adjust the color or background color setting.</p><div
class="mycode"><pre name="code" class="css">
.dp-highlighter ol /* base number colors */
.dp-highlighter .columns div /* odd number colors, I think */
.dp-highlighter .columns /* even numbers */
.dp-highlighter .tools /* toolbar colors */
.dp-highlighter .tools a /* link color in toolbar */
</pre></div><p>The last bit of the CSS information controls the colors of the code within the example. Adjust as needed.</p><h2>Cleanup And Disable SyntaxHighlighter Plugins</h2><p>Update old posts to use the new Pre tag wrapper, then disable old Syntax Highlighter Plugins and code.</p><p>It may seem obvious, but make sure you check check your work!!!</p><hr
/><h4>Let me know what you thought of this article by leaving me a comment below!</h4><p>Let me know what you think in the <a
href="#comments">comments</a> below or send me <a
href="http://technerdia.com/feedback.html">feedback directly</a>.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzg4NV9zeW50YXhoaWdobGlnaHRlci5odG1s">Add Google Code SyntaxHighlighter to WordPress without using a Plugin</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=885" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/885_syntaxhighlighter.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Live jQuery Cart &#8211; Instant Update of Shopping Cart Totals</title><link>http://technerdia.com/758_live-jquery-cart.html</link> <comments>http://technerdia.com/758_live-jquery-cart.html#comments</comments> <pubDate>Thu, 09 Feb 2012 20:53:59 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[jQuery]]></category> <category><![CDATA[formatCurrency]]></category> <category><![CDATA[math]]></category> <category><![CDATA[replaceWith]]></category> <category><![CDATA[shopping cart]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=758</guid> <description><![CDATA[Live Shopping Cart - Update the quantity field, and watch the cart totals update live!<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/758_live-jquery-cart.html">Live jQuery Cart &#8211; Instant Update of Shopping Cart Totals</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p><img
src="http://technerdia.com/files/jquery-cart.gif" alt="jQuery Shopping Cart Example" title="jquery-cart" width="470" height="285" class="aligncenter size-full wp-image-803" /></p><h2>Why a Live jQuery Cart?</h2><p>Customers love a simple shopping experience&#8230; with that, a short join process that includes the totals up front, produces less junk form submits, thus better form conversion ratios. This is uniquely important when it comes to split testing a live cart. Because the live cart has very low junk submits, a micro change to the form (be it design, location of the form, wording, a second step, etc), can &#8220;easily&#8221; be identified as positive or negative in the ratios.</p><ul
class="buttOptions three"><li><a
href="http://demo.technerdia.com/jquery-cart/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Demo', 'VIEW', 'Live jQuery Cart &#8211; Instant Update of Shopping Cart Totals']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/live-jquery-cart.zip" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'ZIP', '/files/live-jquery-cart.zip']);"><span>Download Demo</span></a></li><li><a
href="http://technerdia.com/files/live-jquery-cart.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'PDF', '/files/live-jquery-cart.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</div><p><em>** Let me know what you think by dropping a quick <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=I2NvbW1lbnQ=">comment below</a>, or hit me up on <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Google+</a> or you can <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL2ZlZWRiYWNr" target=\"_blank\">email me feedback</a> directly</em>!</p><hr
/><h2>How does the Live jQuery Cart Work?</h2><p>When the quantity field is updated, the jQuery script is called, which takes the value of quantity and multiplies it by the retail and for sale price values. The retail, today&#8217;s price, savings totals and a hidden input price field get instantly updated by using the jQuery replaceWith function.</p><h2>Breaking down the Live jQuery Cart</h2><h3>The Form</h3><p>The form includes three price point displays, the retail cost, today&#8217;s special and current savings. When the quantity input field is modified, the jQuery is called, adjusting the three totals.</p><div
class="mycode"><pre name="code" class="html"><div class="cart">

    <div class="price">
        <div class="retail">
            <p>Retail Cost</p>
            <span class="pRetail">$125.00</span>
        </div>
        <div class="today">
            <p>Today's Special</p>
            <span class="pToday">$80.00</span>
        </div>
        <br style="clear:both" />
    </div>
    <div class="savings">Current Savings: <span class="save">$45.00</span></div>

    <form action="" method="post">
        <input type="hidden" name="price" value="" class="input" />
        <p><label>Quantity: <input type="text" name="quantity" size="2" value="1" /></label></p>
        <input type="submit" class="addCart" />
    </form>
</div></pre></div><h3>The CSS</h3><p>The CSS contains nothing fancy. The only trick to it is the button, which is displayed through a background call so the transparency works.</p><div
class="mycode"><pre name="code" class="css">/*
  Name: Live jQuery Cart
  URI: http://techNerdia.com/
  Author: tribalNerd
*/
.cart {
	margin:0 auto;
	width:430px;
}
.price {
	margin:15px auto;
	text-align:center;
	width:325px;
}
.retail {
	color:#cc0000;
	float:left;
	font-size:14px;
	font-weight:bold;
	margin:0 0 2px 0;
	text-align:center;
	width:43%;
}
.today {
	color:#7241a8;
	float:right;
	font-size:14px;
	font-weight:bold;
	margin:0 0 2px 0;
	text-align:center;
	width:43%;
}
.retail p, .today p { margin:0 0 2px 0; }
.pRetail, .pToday {
	font-size:32px;
	font-weight:bold;
	line-height:34px;
}
.pRetail {
	text-decoration:line-through;
}
.savings, .save {
	color:#337147;
	font-size:22px;
	font-weight:bold;
	text-align:center;
}
.cart form, .cart label {
	margin:0 auto;
	padding:0;
	width:427px;
}
.cart form p, .cart label { text-align:center; }
.addCart {
	background:url('cartButton.png')no-repeat;
	background-image:url('cartButton.png');
	background-position:0 0;
	background-repeat:no-repeat;
	border:0;
	display:block;
	height:110px;
	margin:0 auto;
	padding:0;
	text-indent: -9999px;
	width:427px;
}</pre></div><h3>The jQuery Cart</h3><p>The jquery-cart.js file is a fun one&#8230;.<ul><li>The script starts off by detecting the key change within the quantity field, it then scrubs the form (to blank) if the quantity field starts with a zero, a letter or a period.</li><li>After the input value is good, the script checks to see if the quantity value is blank, zero or set to one &#8211; for display purposes. If so, the default prices kicks in. Else, the quanity field is 2 or more and the math starts.</li><li>The math takes the quantity value and multiplies it by the retail or price value (today&#8217;s cost). The saved value is the difference between the retail cost and today&#8217;s cost.</li><li>Finally the output happens: When the quantity field updates, the the jQuery executes a <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS5qcXVlcnkuY29tL3JlcGxhY2VXaXRoLw==" target=\"_blank\">replaceWith function</a>. This replaces the 4 html elements above (based on the class names), with the 4 new html lines from the jquery-cart.js file (below the /* output */ line). This is what makes the price values change on the fly.</li></ul><div
class="mycode"><pre name="code" class="js">$('input[name=quantity]').keyup( function() {
	var value = $(this).attr("value");
	while ( value.substring(0, 1) === '0' || value.length > 3 ) { 	/* no leading zero, max 3 chars */
        value = value.substring(1);									/* return to nothing */
    }
	value = value.replace(/[^0-9\.]/g,'');							/* numbers only */
	value = value.replace(/\./g,'');								/* no periods */
	$(this).val(value);
	var real = '125.00'; 	/* retail price */
	var cost = '80.00'; 	/* for sale price */
		if ( value == '' || value == "0" || value == "1" ) { 		/* default */
			var retail = '';
			var saved = '';
			value = '1';
			retail = real;
			saved = real - cost;
		}else{
			var total_cost = '';
			var retail = '';
			var saved = '';
			total_cost = parseInt(value) * cost;
			retail = parseInt(value) * real;
			saved = retail - total_cost;
		}
	var total = '';
	total = parseInt(value) * cost;
/* output */
	$(".pRetail").replaceWith('<span class="pRetail">' + retail + '</span>');
	$(".pRetail").formatCurrency();
	$(".pToday").replaceWith('<span class="pToday">' + total + '</span>');
	$(".pToday").formatCurrency();
	$(".save").replaceWith('<span class="save">' + saved + '</span>');
	$(".save").formatCurrency();
	$(".input").replaceWith('<input type="hidden" name="price" value="' + total + '" class="input" />');
	$(".input").formatCurrency();
} );</pre></div><h2>Required Changes</h2><p>Within the jquery-cart.js file, Lines 9 and 10 need to be updated. Line 9 is the retail price of the product. Line 10 is the for sale price.</p><div
class="mycode"><pre name="code" class="php">var real = '125.00'; /* retail price */
var cost = '80.00'; /* for sale price */</pre></div><p>The jquery-cart.js also contains 4 <strong>replaceWith</strong> lines, when the jQuery file is executed the replaceWith commands updates the HTML in the form.</p><p><strong>The replaceWith lines from the jquery-cart.js file.</strong></p><div
class="mycode"><pre name="code" class="php">$(".pRetail").replaceWith('<span class="pRetail">' + retail + '</span>');
$(".pToday").replaceWith('<span class="pToday">' + total + '</span>');
$(".save").replaceWith('<span class="save">' + saved + '</span>');
$(".input").replaceWith('<input type="hidden" name="price" value="' + total + '" class="input" />');</pre></div><p>The above jQuery lines are: line 28, 30, 32 and 34. Below are related the HTML lines from the form. The lines are: Line 6, Line 10, Line 14 and Line 17. The jQuery lines, update the HTML lines, and it does this by matching the class names.</p><p><strong>Matching lines from the HTML Form.</strong></p><div
class="mycode"><pre name="code" class="html"><span class="pRetail">$125.00</span>
<span class="pToday">$80.00</span>
<span class="save">$45.00</span>
<input type="hidden" name="price" value="" class="input" /></pre></div><p>In most cases, the replaceWith and related HTML lines will need to be updated to match your Websites shopping cart forms. Most shopping carts require extra hidden values to be passed in, like the quantity and many other possible values. Static fields, like store names go into the HTML form directly and would not need to be replaced.</p><h2>The Currency</h2><p>The rounding of the currency and currency used, is managed by <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2pxdWVyeS1mb3JtYXRjdXJyZW5jeS8=" target=\"_blank\">jQuery Format Currency Plugin</a> available at Google Code.<h3>Demo and Download the Live jQuery Cart</h3><ul
class="buttOptions three"><li><a
href="http://demo.technerdia.com/jquery-cart/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Demo', 'VIEW', 'Live jQuery Cart &#8211; Instant Update of Shopping Cart Totals']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/live-jquery-cart.zip" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'ZIP', '/files/live-jquery-cart.zip']);"><span>Download Demo</span></a></li><li><a
href="http://technerdia.com/files/live-jquery-cart.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'PDF', '/files/live-jquery-cart.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</div><ul><li><strong>The zip file contains</strong>: jquery-cart.js, form.html, cartButton.png, style.css and the PDF eBook.<li><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2pxdWVyeS1mb3JtYXRjdXJyZW5jeS8=" target=\"_blank\">Download the jquery.formatCurrency-1.4.0.js file from Google Code.</a></li></ul><hr
/><h4>Have something to say? Something to add? Have a Question?</h4><p>Let me know in the <a
href="#comments">comments</a> below or if comments are closed you may send me your <a
href="http://technerdia.com/feedback.html">feedback</a> directly!!!</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzc1OF9saXZlLWpxdWVyeS1jYXJ0Lmh0bWw=">Live jQuery Cart &#8211; Instant Update of Shopping Cart Totals</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=758" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/758_live-jquery-cart.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Adding a Link to the WordPress Dashboard Menu that opens an Internal or External Page. [Updated]</title><link>http://technerdia.com/557_dashboard-link-in-wordpress.html</link> <comments>http://technerdia.com/557_dashboard-link-in-wordpress.html#comments</comments> <pubDate>Mon, 23 Jan 2012 09:20:16 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Admin Area]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[layouts]]></category> <category><![CDATA[php]]></category> <category><![CDATA[statistics]]></category> <category><![CDATA[wp]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=557</guid> <description><![CDATA[Easily add a Custom Link to your Dashboard Menu...<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/557_dashboard-link-in-wordpress.html">Adding a Link to the WordPress Dashboard Menu that opens an Internal or External Page. [Updated]</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p><b>Updated</b>: <em>January 23, 2012</em> &#8211; This tip walks you through adding a Statistics link for Google Analytics within the WordPress Admin under the Dashboard tab. Then how to add multiple links to the Dashboard menu and finally how to open an internal page from the Dashboard menu.</p><p><b>Sources</b>:</p><ul><li><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcv" target=\"_blank\">The WordPress Codex</a></li><li><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcvQWRtaW5pc3RyYXRpb25fTWVudXM=" target=\"_blank\">Administration Menus</a></li></ul><h2>Adding a Link to the Dashboard of WordPress</h2><p>The example below is two functions. The second function (dashboardMenu) adds the link within the dashboard, then calls the first function (linkedPage).</p><h2>What To Do&#8230;</h2><ul><li>On Line 8 replace the <b>ENTER-YOUR-GOOGLE-ANALYTICS-URL-HERE</b> with your Google Analytics URL or any URL you wish to open.</li><li>On Line 10 replace YOUR-DOMAIN with your domain.</li></ul> <br
/><div
class="mycode"><pre name="code" class="php">
/* The Redirect Function */
function linkedPage(){
	if(!current_user_can('manage_options')){
		wp_die( __('You do not have sufficient permissions to access this page.'));
	}
?&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	window.open(&quot;ENTER-YOUR-GOOGLE-ANALYTICS-URL-HERE&quot;); /* Update This Line */
	function delay(){
		window.location.href = &quot;http://YOUR-DOMAIN.com/wp-admin/index.php&quot;; /* Update This Line */
	}
&lt;/script&gt;
&lt;body onLoad=&quot;setTimeout('delay()', 4000)&quot;&gt;
&lt;? } /* end function */
/* Add Dashboard Link */
function dashboardMenu(){
	if(function_exists('add_submenu_page'))
	add_submenu_page('index.php', __('Statistics'), __('Statistics'), 'manage_options', 'stats', 'linkedPage');
} /* end function */
add_action('admin_menu', 'dashboardMenu');
</pre></div><h2>How Does It Work?</h2><p>When the Statistics link is clicked in the dashboard, the linkedPage function is called. This sets two Javascripts in action, the first opens Google Analytics in a tab-less browser window. The second redirect waits a few seconds, then returns back to your WordPress Admin homepage.</p><h2>Adding Multiple Dashboard Links</h2><p>Duplicate the linkedPage function and rename it, and adjust the urls within the Javascript. Then in the dashboardMenu function, duplicate the <em>add_submenu_page</em> line, adjust the link name and finally replace the linkedPage function with the new function name.</p> <br
/><div
class="mycode"><pre name="code" class="php">
/* Multiple Redirects */
function secondFunctionName(){
	if(!current_user_can('manage_options')){
		wp_die( __('You do not have sufficient permissions to access this page.'));
	}
?&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
	window.open(&quot;OUT-GOING-URL&quot;); /* Update This Line */
	function delay(){
		window.location.href = &quot;http://YOUR-DOMAIN.com/wp-admin/index.php&quot;; /* Update This Line */
	}
&lt;/script&gt;
&lt;body onLoad=&quot;setTimeout('delay()', 4000)&quot;&gt;
&lt;? } /* end function */
/* Add Dashboard Link */
function dashboardMenu(){
	if(function_exists('add_submenu_page'))
	add_submenu_page('index.php', __('Statistics'), __('Statistics'), 'manage_options', 'stats', 'linkedPage');
	add_submenu_page('index.php', __('New Link'), __('New Link'), 'manage_options', 'link', 'secondFunctionName');
} /* end function */
add_action('admin_menu', 'dashboardMenu');
</pre></div><h2>Opening an Internal Page</h2><p>Instead of redirecting to an outsideURL, you can open a page directly within the admin, then add all the links and goodies you like to that page.</p><p>The example below offers two methods for display HTML. The first is to include the html within the function &#8211; a much cleaner way of doing it, and the second is to display the html directly within the function.</p> <br
/><div
class="mycode"><pre name="code" class="php">
function linkedPage(){
	if(!current_user_can('manage_options')){
		wp_die( __('You do not have sufficient permissions to access this page.'));
	}
/* Method #1 - Include the HTML */
//include(&quot;full/path/to/file.php&quot;);
/* */
/* Method #2 - HTML within the Function */ ?&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot; target=&quot;_blank&quot;&gt;Bird is the Word&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;? }
function dashboardMenu(){
	if(function_exists('add_submenu_page'))
	add_submenu_page('index.php', __('My Page'), __('My Page'), 'manage_options', 'mypage', 'linkedPage');
}
add_action('admin_menu', 'dashboardMenu');
</pre></div><h3>Simple Enough!</h3><p>This can save you a bit of time and it can be twisted in many various ways. Add links to Feed Stats, Online Tools, Related Sites, Social Networks and whatever else you like.</p><hr
/><h4>If you enjoyed this post then please post a comment below and let me know!</h4><p>I would love to hear from you in the <a
href="#comments">comments</a> below or send me direct <a
href="http://technerdia.com/feedback.html">feedback</a>.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzU1N19kYXNoYm9hcmQtbGluay1pbi13b3JkcHJlc3MuaHRtbA==">Adding a Link to the WordPress Dashboard Menu that opens an Internal or External Page. [Updated]</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=557" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/557_dashboard-link-in-wordpress.html/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Remove slashes and the http from a URL &#8211; PHP Example</title><link>http://technerdia.com/667_domain-only.html</link> <comments>http://technerdia.com/667_domain-only.html#comments</comments> <pubDate>Wed, 18 Jan 2012 13:17:41 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Functions]]></category> <category><![CDATA[PHP Examples]]></category> <category><![CDATA[domain]]></category> <category><![CDATA[example]]></category> <category><![CDATA[preg_replace]]></category> <category><![CDATA[urldecode]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=667</guid> <description><![CDATA[Simple PHP Snip, decodes an encoded url, strips away the end slash from the url, then remove the http:// from the URL, leaving only the domain.com to deal with.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/667_domain-only.html">Remove slashes and the http from a URL &#8211; PHP Example</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>The PHP example below takes an encoded URL, decodes it, then strips away the slashes and http, leaving only the domain.com to deal with.</p><p><strong>The Snip:</strong></p><div
class="mycode"><pre name="code" class="php">preg_replace( "#^[^:/.]*[:/]+#i", "", preg_replace( "{/$}", "", urldecode( $website ) ) );</pre></div><ul
class="buttOptions two"><li><a
href="http://demo.technerdia.com/remove-slashes/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Demo', 'VIEW', 'Remove slashes and the http from a URL &#8211; PHP Example']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/php-example-remove-all-slashes.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'PDF', '/files/php-example-remove-all-slashes.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</div><h2>Breaking It Down</h2><p>It starts by decoding an encoded URL: It turns, http%3A%2F%2Ftechnerdia.com%2F into http://technerdia.com</p><p>Why is the URL encoded? I use this snip when pulling URLs from a database. The snip still works if the URL isn&#8217;t encoded.</p><p><strong>Decode the Encoded URL</strong><div
class="mycode"><pre name="code" class="php">$website = &quot;http%3A%2F%2Ftechnerdia.com%2F&quot;;
$website = urldecode( $website );
echo $website;
/* Result: http://technerdia.com/ */</pre></div></p><p><strong>Removing Trailing Slash from the URL</strong><div
class="mycode"><pre name="code" class="php">$website = &quot;http://technerdia.com/&quot;;
$website = preg_replace( &quot;{/$}&quot;, &quot;&quot;, $website );
echo $website;
/* Result: http://technerdia.com */</pre></div></p><p><strong>Remove the http:// from the URL</strong><div
class="mycode"><pre name="code" class="php">$website = &quot;http://technerdia.com&quot;;
$website = preg_replace( "#^[^:/.]*[:/]+#i", "", $website );
echo $website;
/* Result: technerdia.com */</pre></div></p><p><strong>That&#8217;s It!</strong></p><p><strong>Make It All One Line</strong><br
/> You can stack it all together and simply echo the line, instead of typing all that out.</p><div
class="mycode"><pre name="code" class="php">$website = &quot;http%3A%2F%2Ftechnerdia.com%2F&quot;;
echo preg_replace( "#^[^:/.]*[:/]+#i", "", preg_replace( "{/$}", "", urldecode( $website ) ) );
/* Result: technerdia.com */</pre></div><ul
class="buttOptions two"><li><a
href="http://demo.technerdia.com/remove-slashes/" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Demo', 'VIEW', 'Remove slashes and the http from a URL &#8211; PHP Example']);"><span>View the Demo</span></a></li><li><a
href="http://technerdia.com/files/php-example-remove-all-slashes.pdf" target="_blank" class="postButton" onClick="javascript: _gaq.push(['_trackPageview', 'Downloads', 'PDF', '/files/php-example-remove-all-slashes.pdf']);"><span>Download PDF</span></a></li></ul><div
class="br">&nbsp;</div><h2>This little snip of code is a time saver, that&#8217;s its job!</h2><p>When you insert URL&#8217;s into a database and also need the domain.com inserted, use this to strip away the garbage rather than typing in the domain.com each time. On the flip side, maybe you only have the URL and need the domain.com, which is typical in APIs or building URLs for sites like Alexa and Site Explorer Tools, and of course many other reasons.</p><hr
/><h4>Have a comment, corrections, improvements or feedback?</h4><p>Let me know in the <a
href="#comments">comments</a> below or <a
href="http://technerdia.com/feedback.html">send me feedback</a> directly.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzY2N19kb21haW4tb25seS5odG1s">Remove slashes and the http from a URL &#8211; PHP Example</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=667" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/667_domain-only.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Using Shortcodes to Display and Manipulate Custom PHP Code within WordPress Posts or Pages</title><link>http://technerdia.com/579_shortcodes.html</link> <comments>http://technerdia.com/579_shortcodes.html#comments</comments> <pubDate>Wed, 11 Jan 2012 19:27:15 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Shortcodes]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[code]]></category> <category><![CDATA[php]]></category> <category><![CDATA[shortcode]]></category> <category><![CDATA[wp]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=579</guid> <description><![CDATA[Shortcodes are the perfect tool to use for pulling in Affiliate API's directly into posts or pages, by passing in variables within the Shortcode directly, which manipulates the output or display of the API.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/579_shortcodes.html">Using Shortcodes to Display and Manipulate Custom PHP Code within WordPress Posts or Pages</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>From <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcvU2hvcnRjb2RlX0FQSQ==" target=\"_blank\">WordPress</a>, a <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLnN1cHBvcnQud29yZHByZXNzLmNvbS9zaG9ydGNvZGVzLw==" target=\"_blank\">Shortcode</a> is: a simple set of functions for creating macro codes for use in post content.</p><div
align="center"><img
src="http://technerdia.com/files/shortcodes.gif" alt="Wordpress Shortcode Examples" title="shortcodes" width="560" height="156" class="aligncenter" /></div><p>Shortcodes are the perfect tool to use for pulling in Affiliate <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9BcHBsaWNhdGlvbl9wcm9ncmFtbWluZ19pbnRlcmZhY2U=" target=\"_blank\">API</a>&#8216;s directly into WordPress, by passing in variables within the Shortcode directly, which manipulates the output or display of the API. Because Shortcodes are built in WordPress Functions, caching plugins will work on them. Another words, using Shortcodes to display API&#8217;s instead of writing a custom plugin, means you don&#8217;t also have to write in extra code for caching!</p><p><strong>The functions.php file</strong><br
/> Shortcode Functions get added directly into the <em>functions.php</em> file of a theme.<h2>A Basic Shortcode Function</h2><p>Shortcodes need a function assigned to them to make them, function. Below is a basic example of this taking place.</p> Place the below within the <i>functions.php</i> file:<div
class="mycode"><pre name="code" class="php">function myShortcode() {
    return 'Hello!';
}
add_shortcode( shortcode_name, myShortcode );</pre></div><p>In the last line above, the add_shortcode Function contains the name of the short code (shortcode_name) and calls the function above it (myShortcode). The name of this shortcode is: shortcode_name and the function name is: myShortcode</p><ul><li>Use a shortcode name that relates to the purpose of the function.</li><li>Always use lowercase letters in your Shortcode names.</li></ul> <strong>Shortcode Call</strong>: The Shortcode will return the text: Hello<div
class="mycode"><pre name="code" class="php">[shortcode_name]</pre></div><p>This is a rather basic example, you can find many ways to use them with a quick <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nb29nbGUuY29tL3NlYXJjaD9xPXdvcmRwcmVzcytzaG9ydGNvZGUrZXhhbXBsZXM=" target=\"_blank\">Google Search</a>, they are amazingly versatile, so don&#8217;t be afraid to play with them.</p><h2>Passing an Attribute to the Shortcode</h2><p>Rather than simply returning Hello, the Shortcode can have text passed directly to it. The text can be returned, or used to activate an if or switch statement. The example below checks to see if $atts is passed in, if so it returns the results of param, which is Hello World!</p><div
class="mycode"><pre name="code" class="php">function myShortcode( $atts ) {
if ( $atts) {
    return $atts['param'];
}
}
add_shortcode( shortcode_name, myShortcode );</pre></div> <strong>Passing in an Attribute</strong>:<div
class="mycode"><pre name="code" class="php">[shortcode_name param=&quot;Hello World!&quot;]</pre></div><p>Both of the above examples are some what limited, to unlock the full potential of Shortcodes, Attributes need to be passed in.</p><h2>Attributes within Shortcodes</h2><p>Attributes are basically Variables ($a) that get passed into the Shortcode Function.</p> This is done simply by adding in the following to the function:<div
class="mycode"><pre name="code" class="php">extract( shortcode_atts( array( 'variable' =&gt; 'value', ), $atts ) );</pre></div><p>The array() contains a variable(s) that may or may not equal something, in this case the variable equals value. Add more Variables by adding to the Array:<div
class="mycode"><pre name="code" class="php"> 'variable' =&gt; 'value', 'another-var' =&gt; 'another-value', </pre></div> <strong>Full example</strong>:<div
class="mycode"><pre name="code" class="php">extract( shortcode_atts( array( 'variable' =&gt; 'value', 'another-var' =&gt; 'another-value', ), $atts ) );</pre></div><p>Typically using Shortcodes with Attributes means something more complex is happening than displaying a single line of text, being so the output needs to be captured before displaying it.</p><h2>Output Buffering</h2><p>An Advanced Shortcode is basically useless without capturing the output of the code. Without it, code can display at wrong times or locations and depending on what the code does within the Shortcode function, it may return header warnings.</p><p>To correct this we use a few PHP functions: <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLm9iLXN0YXJ0LnBocA==" target=\"_blank\">ob_start</a>, <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLm9iLWdldC1jb250ZW50cy5waHA=" target=\"_blank\">ob_get_contents</a> and <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLm9iLWVuZC1jbGVhbi5waHA=" target=\"_blank\">ob_end_clean</a>. These functions capture the output of the code into a memory first, then displays (or cleans) the output based on the order it was captured in.</p><h2>Example Shortcode Function Using Output Buffering</h2><p>In the example below, we capture the if statements results based on the variable&#8217;s value.</p><div
class="mycode"><pre name="code" class="php">function myShortcode( $atts ) {
	extract( shortcode_atts( array( 'variable' =&gt; '', ), $atts ) );
	ob_start();
		if ( $variable == '' ) { echo &quot;Do Nothing!&quot;; }
		if ( $variable == '1' ) { echo &quot;Do This Code!&quot;; }
		if ( $variable == '2' ) { echo &quot;Do That Code!&quot;; }
	$output_string = ob_get_contents();
	ob_end_clean();
		return $output_string;
}
add_shortcode( short_code_name, myShortcode);</pre></div> <strong>This Shortcode will return</strong>: <em>Do This Code!</em><div
class="mycode"><pre name="code" class="php">[shortcode_name variable=&quot;1&quot;]</pre></div><h2>Advanced Example Shortcode Function</h2><p>This example captures an XML Feed, loads it into a string, then manipulates the output based on the passed in Attributes. This Shortcode can display various outputs based on the value of type. When type=cars a unique API Url is called, then we foreach through each result, correct the HTML entities and cut the description length off at 255 characters before returning them.</p><div
class="mycode"><pre name="code" class="php">function myShortcode( $atts ) {
	extract( shortcode_atts( array( 'type' =&gt; '', 'debug' =&gt; '', ), $atts ) );
	ob_start();
/* start code */
if ( !$type ) { $type = &quot;cars&quot;; }
if ( $type == &quot;cars&quot; ) {
	$apiUrl = file_get_contents(&quot;http://apiurl.com/&quot;);
}
if ( $type == &quot;boats&quot; ) {
	$apiUrl = file_get_contents(&quot;http://apiurl.com/&quot;);
}
if ( $type ) {
	$xml = simplexml_load_string($apiUrl);
	if( $debug ){echo &quot;&lt;pre&gt;&quot;;print_r($xml);echo &quot;&lt;/pre&gt;&quot;; exit;}
}
if ( $type == &quot;cars&quot; ) {
	 foreach($xml-&gt;cars as $car){
		$title = $car-&gt;title;
		$about = $car-&gt;description;
			echo '&lt;h2&gt;'. htmlentities($title); .'&lt;/h2&gt;';
			echo '&lt;p&gt;'. substr($about,0,255); .'&lt;/p&gt;';
	}
}
if ( $type == &quot;boats&quot; ) {
	$name = $xml-&gt;boats-&gt;boat-&gt;name;
	echo $name;
}
/* end code */
	$output_string = ob_get_contents();
	ob_end_clean();
		return $output_string;
}
add_shortcode( short_code_name, myShortcode);</pre></div> <strong>The Shortcodes</strong><div
class="mycode"><pre name="code" class="php">[short_code_name type=&quot;cars&quot;]
[short_code_name type=&quot;boats&quot;]
[short_code_name type=&quot;cars&quot; debug=&quot;1&quot;]</pre></div><p>As you can see, a single Shortcode can contain many &#8220;rules&#8221; before executing the code. As long as you capture the output, it really makes no difference what you do. You could connect to Mysql, run advanced math, call other functions and classes, include other files, and much more &#8211; all within one Shortcode.</p><p>This does not mean you should stack everything into a single Shortcode, but it does mean it&#8217;s possible!</p><h2>What one of my Shortcode functions looks like</h2><p>This is one of my actual Shortcode functions. I pass in several Attributes in, however I only call one or few at a time, each of which manipulate the results of the included api.php file.</p><p>The <i>show</i> variable in the shortcode_atts array is set to <i>full</i> (show=full), this means the default value of show to full, thus if nothing is passed in it&#8217;s value is full, otherwise its value is whatever is passed in from the Shortcode.</p><div
class="mycode"><pre name="code" class="php">function apiData_func( $atts ) {
		extract( shortcode_atts( array('type' =&gt; '', 'show' =&gt; 'full', 'letter' =&gt; '', 'site' =&gt; '', 'start' =&gt; '', 'search' =&gt; '', 'speed' =&gt; '', 'filter' =&gt; 'filter', ), $atts ) );
	ob_start();
	  include('api.php');
	 $output_string = ob_get_contents();
	ob_end_clean();
   return $output_string;
 }
add_shortcode( api_data, apiData_func );</pre></div> <strong>The Shortcode</strong><div
class="mycode"><pre name="code" class="php">[api_data type=&quot;golf&quot; letter=&quot;a&quot; start=&quot;1&quot; ]</pre></div><p>This Shortcode would display golf products, starting with the letter A on page 1, and would &#8216;show&#8217; the &#8216;full&#8217; information template.</p><h2>Enable Shortcodes in Sidebar Widgets</h2><p>Add the line below (as is) to your themes <em>function.php</em> file to turn on Shortcodes within Widgets. Now the same [ShortCodes] used within Posts and Pages can be used within Sidebar Widgets.</p><div
class="mycode"><pre name="code" class="php">add_filter('widget_text', 'do_shortcode', 11);</pre></div><h3>What is the 11?</h3><p>That is the Priority number, this tells WordPress to load <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcvRnVuY3Rpb25fUmVmZXJlbmNlL2RvX3Nob3J0Y29kZQ==" target=\"_blank\">do_shortcode</a> after the WordPress content has started to load. In some unique cases you may need the Shortcode to load before WordPress, like when modifying headers, then the Priority number would be 9 (I believe). Other times you may have nested the Shortcodes, and need them to execute in an order. Typically, it stays 11 or gets excluded all together.</p><hr
size="1" width="99%" /><p>Shortcodes are the ultimate WordPress Shortcuts and when it comes to API&#8217;s &#8211; Shortcodes are a godsend!</p><hr
/><h4>Let me know what you thought of this article by leaving me a comment below!</h4><p>Let me know what you think in the <a
href="#comments">comments</a> below or send me <a
href="http://technerdia.com/feedback.html">feedback directly</a>.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzU3OV9zaG9ydGNvZGVzLmh0bWw=">Using Shortcodes to Display and Manipulate Custom PHP Code within WordPress Posts or Pages</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=579" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/579_shortcodes.html/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Find the Parent Post ID and Children ID&#8217;s of Multiple Nested Posts or Pages &#8211; WordPress Tip</title><link>http://technerdia.com/573_post-ancestors.html</link> <comments>http://technerdia.com/573_post-ancestors.html#comments</comments> <pubDate>Tue, 03 Jan 2012 20:05:40 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Functions]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[children]]></category> <category><![CDATA[pages]]></category> <category><![CDATA[parent]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wp]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=573</guid> <description><![CDATA[Find the Parent Post ID from a Child Page, when that Child Page is multiple nested levels deep.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/573_post-ancestors.html">Find the Parent Post ID and Children ID&#8217;s of Multiple Nested Posts or Pages &#8211; WordPress Tip</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>Google is filled with countless WordPress users asking <i>How to find the Parent Post ID from a Child Page</i>, when that Child Page is multiple nested levels deep. And like those users, I recently found myself asking this same question.</p><p>Unfortunately this is one question that has more answers, solutions, and headaches than even Google can understand. All the solutions I did find did not recursively go through endless children posts, the rest simply didn&#8217;t work.</p><p>So I kept looking and I&#8217;m glad that I did&#8230;.</p><p>Even though this is still a popular topic today, it appears WordPress solved this problem way back in version 2.5, with the function <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcvRnVuY3Rpb25fUmVmZXJlbmNlL2dldF9wb3N0X2FuY2VzdG9ycw==" target=\"_blank\">get_post_ancestors</a>.</p><p>The <strong>get_post_ancestors</strong> function creates an array of Post ID&#8217;s, starting on the first Child Page. So if you&#8217;re 50 nested pages and on the 50th page, this function would display every post id, for every page, up to the parent page.</p><p><u>Note</u>: This function does not display the Parent Post ID IF you are on the Parent Post Page itself &#8211; You must be at least one level deep for it to work.</p><hr
size="1" /><h2>Examples of get_post_ancestors</h2><div
class="mycode"><pre name="code" class="php"> /* Example use of get_post_ancestors */
/*Outside Loop: like the sidebar, footer, etc. */
$ancestors = get_post_ancestors( $wp_query-&gt;post );
/*Within Loop: Pages template. */
$postid = get_the_ID();
$ancestors = get_post_ancestors( $postid );</pre></div><p>The <i>results of get_post_ancestors</i> in now in an Array named, $ancestors. For development purposes you may want to view the results of the array.</p><div
class="mycode"><pre name="code" class="php"> /* Display $ancestors */
echo &quot;&lt;pre&gt;&quot;;
print_r($ancestors):
echo &quot;&lt;/pre&gt;&quot;;</pre></div><div
class="mycode"><pre name="code" class="php"> /* Output of $ancestors */
Array
(
    [0] =&gt; 824
    [1] =&gt; 822
    [2] =&gt; 796
)</pre></div><p>In the example above, the Parent Post ID would be: 796 &#8211; Or the last value in the array.</p><p>You can access the unique value by calling it directly: This would only work if if you are two levels deep from the parent.</p><div
class="mycode"><pre name="code" class="php">echo $ancestors[2];</pre></div><h2>PHP Function in_array</h2><p>In the example below, we use the PHP function <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmluLWFycmF5LnBocA==" target=\"_blank\">in_array</a> to look at all the values returned in the Array, rather than calling each value, like above.</p><div
class="mycode"><pre name="code" class="php"> /* http://php.net/manual/en/function.in-array.php */
in_array( &quot;796&quot;, $ancestors );</pre></div><p><b>Example Use</b>: In the example below, if ID 796 is found in the $ancestors Array, the if statement would echo: Found In Array</p><div
class="mycode"><pre name="code" class="php"> /* Full example use of get_post_ancestors */
$ancestors = get_post_ancestors( $wp_query-&gt;post );
if( in_array( &quot;796&quot;, $ancestors ) ){ echo &quot;Found In Array&quot;; }</pre></div><h2>Practical Use</h2><p>I use the <strong>get_post_ancestors</strong> function within the sidebar.php file of a few product related websites. When the parent page or child page of that parent is loaded, a unique sidebar &#038; widget is called based on the ID. The widget contains a unique, yet typical list style menu that contains nested  items within the list.</p> <b>Example Nested List</b>:<div
class="mycode"><pre name="code" class="php">  &lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Parent Page&lt;/a&gt;
   &lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Child Page 1&lt;/a&gt;
	  &lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Sub-Child Page 2&lt;/a&gt;
		  &lt;ul&gt;
			&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Sub-Sub-Child Page 3&lt;/a&gt;&lt;/li&gt;
		  &lt;/ul&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Sub-Child Page 4&lt;/a&gt;&lt;/li&gt;
	  &lt;/ul&gt;&lt;/li&gt;
   &lt;/ul&gt;&lt;/li&gt;
  &lt;/ul&gt;</pre></div><h2>Example Use In Sidebar</h2><p>This will display the custom sidebar-widget menu on the Parent Page and all Child Pages of that Parent.</p><div
class="mycode"><pre name="code" class="php"> /* get_post_ancestors in the sidebar */
if( function_exists('dynamic_sidebar') ) {
 $ancestors = get_post_ancestors( $wp_query-&gt;post ); /* Build Ancestors Array*/?&gt;
&lt;div id=&quot;sidebar&quot;&gt;
&lt;?php if( is_page(796) || in_array( &quot;796&quot;, $ancestors ) ){ dynamic_sidebar(Sidebar1); }?&gt;
&lt;/div&gt;</pre></div><p>The <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGV4LndvcmRwcmVzcy5vcmcvRnVuY3Rpb25fUmVmZXJlbmNlL2lzX3BhZ2U=" target=\"_blank\">is_page</a> function: This function checks to see if the Parent Page is being shown. If you only wanted the custom menu to display on the Child pages, remove is_page() from the above if statement.</p><h2>Custom sidebar.php file using get_post_ancestors</h2><p>A more complete example of using the get_post_ancestors function within the sidebar.php file.</p><div
class="mycode"><pre name="code" class="php"> /* get_post_ancestors in the sidebar */
&lt;?php if( function_exists('dynamic_sidebar') ) {
 $ancestors = get_post_ancestors( $wp_query-&gt;post ); 						/* Build Ancestors Array*/
?&gt;
   &lt;div id=&quot;sidebar&quot;&gt;
&lt;?php /* sidebars */
   if( is_home() ){
	 dynamic_sidebar(Sidebar1);								/* home menu */
   }else{
	if( is_page(796) || in_array( &quot;796&quot;, $ancestors ) ){ dynamic_sidebar(CustomMenu); }	/* widget */
//	if( is_page(###) || in_array( &quot;###&quot;, $ancestors ) ){ dynamic_sidebar(Side-Bar-Name); }	/* example widget */
   }
   if( !is_home() ){ dynamic_sidebar(Sidebar2); }						/* non-home mneu */
?&gt;
   &lt;/div&gt;
} /* end dynamic_sidebar */
?&gt;</pre></div><hr
size="1" /><p>It&#8217;s that simple&#8230; this method can be used throughout a theme, simply make sure you&#8217;re passing the <i>post id</i> into get_post_ancestors, and everything will work perfectly!</p><hr
/><h4>If this article helped you then please post a comment below and let me know!</h4><p>I would love to hear from you in the <a
href="#comments">comments</a> below or if comments are not open <a
href="http://technerdia.com/feedback.html">send me feedback</a> directly.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzU3M19wb3N0LWFuY2VzdG9ycy5odG1s">Find the Parent Post ID and Children ID&#8217;s of Multiple Nested Posts or Pages &#8211; WordPress Tip</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=573" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/573_post-ancestors.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>10 Steps to Replacing Feedburner With Your Own Feed URL &#8211; with Statistics</title><link>http://technerdia.com/524_removing-feedburner.html</link> <comments>http://technerdia.com/524_removing-feedburner.html#comments</comments> <pubDate>Mon, 11 Apr 2011 19:49:48 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Customizing]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[feed]]></category> <category><![CDATA[feedburner]]></category> <category><![CDATA[htaccess]]></category> <category><![CDATA[plugins]]></category> <category><![CDATA[rss]]></category> <category><![CDATA[wp]]></category> <category><![CDATA[xml]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=524</guid> <description><![CDATA[This article covers removing Feedburner from your Wordpress Websites and setting up your own RSS Feeds with Statistics, Advertisements and Scraper Protection.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/524_removing-feedburner.html">10 Steps to Replacing Feedburner With Your Own Feed URL &#8211; with Statistics</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p><img
src="http://technerdia.com/files/feedburner.gif" alt="Feedburner" width="100" height="100" class="alignleft size-full wp-image-528" />This article covers removing Feedburner from your WordPress Websites and setting up your own RSS Feeds with Statistics, Advertisements and Scraper Protection.</p><p><strong>Two Methods To Removing Feedburner.</strong></p><ol><li>Create a temporary Feed that will be used in Feedburner, forcing your readers to update now!</li><li>Using a notice within your current Feeds, allowing your readers to naturally move over to your new Feed.</li></ol><p>Sites like techNerdia, with a relatively low reader count can force readers to update the Feed URL&#8217;s now&#8230; It is not hurting me much, if any because of my size. However, for active sites with a large number of readers, an aggressive change like this will make people unhappy, so giving them a notice is a much better option.</p><p><strong>Before We Start</strong>: Steps 1 ½ (removing plugins), step #3 and step #6 can be skipped by those not wanting to aggressively force readers to update Feed URLs OR if you use the Email Subscriptions feature within Feedburner.</p><p><strong>Why am I removing Feedburner?</strong><br
/> First, it&#8217;s not winning any speed points loading the external Feedburner graphic on my Website. I know it&#8217;s really nothing and I could simply not use it. But in the future I would like to show off my new feed count, and hosting it myself is a speed gain.</p><p>Secondly, I already give Google enough of my freak&#8217;in data&#8230;.. And Finally, this being the real reason &#8211; I added up the time I spent on external services, checking stats or data type information, and it&#8217;s disturbingly a high number of HOURS &#8211; so my goal overall is to reduce the time spent on external services of all types.</p><p>Excuses aside; I&#8217;ve found a way to replace Feedburner, help move subscribers over to my new Feed, with statistics, including advertising, while keeping scrapers at bay, all within WordPress. And I&#8217;m saving some time by not having to visit another external service.</p><p><strong><em>If you&#8217;ve setup your own WordPress Websites and can manage them yourself, then you can do this&#8230;</em></strong></p><h2>Step 1:</h2><h3>WordPress Plugins</h3><p>Starting things off is three WordPress Plugins that need to be installed. After this, you may need to shut a few off if you&#8217;re taking the aggressive route.</p><p>These plugins take care of the dirty work that Feedburner did for you. The other features, such as pinging can be taken care within WordPress and Twitter Posts can easily be done with several plugins or many services that can read your feed.</p><h4>Installing Plugins</h4><ol><li><strong><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvcnNzLWZvb3Rlci8=" target=\"_blank\" rel=\"nofollow\">RSS Footer</a></strong>: This plugin has two purposes. The first is to help stop scrapers from taking your Feeds  and posting them without credit, and it&#8217;s a way to include advertisements.</li><li><strong><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvd29yZHByZXNzLWZlZWQtc3RhdGlzdGljcy8=" target=\"_blank\" rel=\"nofollow\">Feed Statistics</a></strong>: As the name suggests, it&#8217;s feed statistics. While it&#8217;s not as good as FeedBurner&#8217;s pretty stats, it does do the job.</li><li><strong><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvcmVkaXJlY3Rpb24v" target=\"_blank\" rel=\"nofollow\">Redirection</a></strong>: <u>Optional</u>: This Plugin is recommended for Multisite Networks but any WP Install can use it. If your sites are setup on the WordPress Multisite Network then you&#8217;ll need the Redirection Plugin to handle 301 redirects for each unique site. Otherwise, you can use the .htaccess file in the root of your WordPress site to set up redirects. (Explained Below)</li></ol><h4>Shutting Off Plugins &amp; Social Networks.</h4><p><strong>Not everyone needs to do these steps&#8230;.</strong> If you&#8217;re going to naturally move your readers over or if you use Feedburner&#8217;s Email Subscriptions feature then skip these steps.</p><ul><li><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZlZWRidXJuZXIuZ29vZ2xlLmNvbQ==" target=\"_blank\">Log into Feedburner</a>, click the Publicize Tab and shut off Ping Shot and Socialize if they&#8217;re setup.</li><li>Shut Off Plugins that help socialize posts through your Feedburner URL.</li><li>Shut Off Social Networks that use your Feedburner URL for posting updates</li></ul><hr
size="1" /><h2>Step 2:</h2><h3>Setting Up RSS Footer</h3><p>The <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvcnNzLWZvb3Rlci8=" target=\"_blank\" rel=\"nofollow\">RSS Footer Plugin</a> is a key feature to keeping your feeds safe from scrapers or at least making sure you get credit when it happens, and offering some advertising to your readers if you like.</p><p>In the example below, the big red box can be text or an advertisement/promo, put in whatever you like. The bold text below the red box is actually more important. The purpose of not linking the Domain Name is to help stop scrapers from ripping out everything within HTML tags, thus leaving the original source to where the article can be found.</p><p><strong>Example #1</strong> &#8211; HTML that asks readers to Update the Feed URL. This should be used if you&#8217;re not forcing your readers to update (ie: a slow change over), perfect for sites with a large active reader base.</p><div
class="mycode"><pre name="code" class="html"><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:left;"><u>NOTICE - PLEASE READ</u> Please update our Feed URL As Soon As Possible - we're removing Feedburner! Thanks ~tribalNerd <u>NEW Feed URL</u> <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL2ZlZWQ=" target=\"_blank\">http://technerdia.com/feed</a></div>
<p>Thanks For Reading %%POSTLINK%%</b> from <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></p></pre></div><p><strong>What Example #1 Looks Like:</strong><br
/><div
style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:2px 10px 40px 0;text-align:left"><u>NOTICE &#8211; PLEASE READ</u> Please update our Feed URL As Soon As Possible &#8211; we&#8217;re removing Feedburner! Thanks ~tribalNerd <u>NEW Feed URL</u> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL2ZlZWQ=" target=\"_blank\">http://technerdia.com/feed</a></div></p><p>Thanks For Reading %%POSTLINK%%</b> from <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></p><p><strong>Example #2</strong> &#8211; Current HTML I put into my RSS Footer.</p><div
class="mycode"><pre name="code" class="html"><div style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:40px 10px;text-align:center;">Thanks For Reading %%POSTLINK%%</b> from <a href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></div>
<p align="center">~ <b>Visit the New techNerdia.com today</b> ~</p></pre></div><p><strong>What Example #2 Looks Like:</strong><br
/><div
style="clear:both;border:2px dashed #c00;text-align:left;font-weight:bold;font-size:16px;padding:8px 10px;margin:2px 10px 40px 0;text-align:center">Thanks For Reading %%POSTLINK%%</b> from <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia.com</a></div></p><p
align="center">~ <b>Visit the New techNerdia.com today</b> ~</p><hr
size="1" /><h2>Step 3:</h2><h3>Creating a Temporary RSS Feed</h3><p>This feed is used to replace your Feed URL in Feedburner, giving the viewer a custom message to update the Feed URL, every single day, until they update. It is aggressive, but it works!</p><ul><li><strong>View the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC94bWwvcnNzLXRuLnhtbA==" target=\"_blank\" rel=\"nofollow\">Temp techNerdia Feed</a> that I created.</strong></li><li><strong>View the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZlZWRzMi5mZWVkYnVybmVyLmNvbS9UZWNoLU5lcmRpYQ==" target=\"_blank\" rel=\"nofollow\">Feed at FeedBurner</a> for a different view.</strong></li></ul><p>Grab the example below, <strong>name it</strong>: <u>rss-mySite.xml</u> &#8220;One You Modify It&#8221; FTP to your WordPress install, create a folder called xml (or whatever), then upload the file. <strong>Note</strong>: The file extension should be .xml</p><p><strong>The example below</strong> is really 3 sections. Inside of each section is a title, description, link, and guid link that needs to be modified. The first title section is the name of the feed, the next two title sections would be the updates that are displayed. This script will re-post the same message every day.</p><p><em>* In the example below replace the titles, desc&#8217;s and links to match your own information. It&#8217;s not a perfect feed, but it does the job and that&#8217;s all it needs to do.</em></p><div
class="mycode"><pre name="code" class="xml">&lt;?php echo(&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?\n&quot;);?&gt;
&lt;rss version=&quot;2.0&quot;&gt;
&lt;channel&gt;
&lt;title&gt;techNerdia [UPDATE]&lt;/title&gt;
&lt;description&gt;Please Update Your Feed URL&lt;/description&gt;
&lt;link&gt;http://technerdia.com/feed&lt;/link&gt;
&lt;lastBuildDate&gt;&lt;?php echo date('l, j M Y');?&gt; 00:00:01 -1600&lt;/lastBuildDate&gt;
&lt;pubDate&gt;&lt;?php echo date('l, j M Y');?&gt; 00:00:01 -1600&lt;/pubDate&gt;
&lt;item&gt;
&lt;title&gt;TechNerdia [UPDATE] Please Change Your Feed URL&lt;/title&gt;
&lt;description&gt;Please Update Your Feed URL to technerdia.com/feed &lt;a href=&quot;http://technerdia.com/feed&quot;&gt;http://technerdia.com/feed&lt;/a&gt; ....then Delete The Feedburner Feed URL that is currently being used. ~ Thanks!&lt;/description&gt;
&lt;link&gt;http://technerdia.com/feed&lt;/link&gt;
&lt;guid isPermaLink=&quot;false&quot;&gt;http://technerdia.com/feed&lt;/guid&gt;
&lt;pubDate&gt;&lt;?php echo date('l, j M Y');?&gt; 00:00:01 -1600&lt;/pubDate&gt;
&lt;/item&gt;
&lt;item&gt;
&lt;title&gt;Questions or Problems?&lt;/title&gt;
&lt;description&gt;If you're having problems or have a question about the feed change or something else, simply &lt;a href=&quot;http://technerdia.com/help&quot;&gt;drop me an email&lt;/a&gt;.&lt;/description&gt;
&lt;link&gt;http://technerdia.com/help&lt;/link&gt;
&lt;guid isPermaLink=&quot;false&quot;&gt;http://technerdia.com/help&lt;/guid&gt;
&lt;pubDate&gt;&lt;?php echo date('l, j M Y');?&gt; 00:00:02 -1600&lt;/pubDate&gt;
&lt;/item&gt;
&lt;/channel&gt;
&lt;/rss&gt;</pre></div><h4>.htaccess</h4><p>Grab the directive below, and upload a .htaccess file <strong>to your /xml/ folder</strong>. This will allow the php to parse the xml, making the feed work.</p><div
class="mycode"><pre name="code" class="php">AddType application/x-httpd-php .php .xml</pre></div><ul><li>Now log into your <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZlZWRidXJuZXIuZ29vZ2xlLmNvbQ==" target=\"_blank\" rel=\"nofollow\">Feedburner Account</a>, select the Feed you&#8217;re going to modify, click Edit Feed at the top (next to the rss icon) &#8211; and modify the Feed URL.</li><li>You may need to Subscribe to your feed in a <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5nb29nbGUuY29tL3JlYWRlcg==" target=\"_blank\" rel=\"nofollow\">Reader</a> to view how your readers will see it.</li><li>The message you put into your rss-mySite.xml should now display OR if you&#8217;re doing a natural update your new message should appear.</li></ul><hr
size="1" /><h2>Step 4:</h2><h3>Setting Up Feed Statistics</h3><p>Setting and using the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvd29yZHByZXNzLWZlZWQtc3RhdGlzdGljcy8=" target=\"_blank\" rel=\"nofollow\">Feed Statistics Plugin</a> is rather straight forward. However, it appears I may have found a bug, which could very well relate to WordPress Multisite, either way &#8211; it&#8217;s easy to correct.</p><p>Access the Feed Menu &gt; Feed Link &#8211; which is the default page when first opened. The end of the first line will tell you how many feed subscribers you currently have.</p><p>The issue I was having was updating the number of days and checking the first box. Every time I changed it to 30 and checked, it reset itself &#8211; even when I made the change in the DB, accessing the script reset the options.</p><p><strong>To beat this, I made some very simple adjustments in the Plugin itself.</strong></p><ul><li>FTP to your /wp-content/plugins folder and go into /wordpress-feed-statistics/ &#8211; Download the <u>feed-statistics.php</u> file.</li><li>Search for two things, both are with functions called &#8216;update_option&#8217;</li></ul><p><strong>Search for:</strong></p><div
class="mycode"><pre name="code" class="php">update_option(&quot;feed_statistics_track_clickthroughs&quot;, &quot;0&quot;);
update_option(&quot;feed_statistics_expiration_days&quot;,&quot;3&quot;);</pre></div><ul><li>Replace the track_clickthroughs lines in two locations.</li><li>Replace the expiration_days change line in one location.</li><li>Save the file and re-upload.</li></ul><p><strong>Replace With:</strong></p><div
class="mycode"><pre name="code" class="php">update_option(&quot;feed_statistics_track_clickthroughs&quot;, &quot;1&quot;);
update_option(&quot;feed_statistics_expiration_days&quot;,&quot;30&quot;);</pre></div><hr
size="1" /><div
align="center" style="font-size:28px"><strong>Making The Change Live</strong></div><h2>Step 5:</h2><h3>Changing / Setting Up Feed URL Redirects</h3><p>If you currently 301 Redirect your Feeds to Feedburner you&#8217;ll need to disable the directs and point them to the root Feed URL on your site, that you put into Feedburner originally. <strong>Something like</strong>: <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL2ZlZWQ=" target=\"_blank\" rel=\"nofollow\">http://technerdia.com/feed</a></p><p><strong>Redirects</strong>: You have two choices basically.</p><ul><li>For standalone WordPress sites I recommend setting up the redirects in your root .htaccess file, this is the fastest and most reliable way to do the redirects. The examples below are the long methods to doing redirects, <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5hc2thcGFjaGUuY29tL2h0YWNjZXNzL3JlZGlyZWN0aW5nLXdvcmRwcmVzcy1mZWVkcy10by1mZWVkYnVybmVyLmh0bWw=" target=\"_blank\" rel=\"nofollow\">read this article</a> for RewriteRules for Feedburner that can easily be changed to your own feed URL.</li><li>For WordPress Multisites you can&#8217;t do this without sites conflicting, so I recommend using the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvcmVkaXJlY3Rpb24v" target=\"_blank\" rel=\"nofollow\">Redirection Plugin</a>, which works perfectly on Multisite installs.</li></ul><p><strong>Example 1</strong> .htaccess files redirects &#8211; Keeping comment, category, and other post feeds while redirecting main Feed URLs into one location.</p><div
class="mycode"><pre name="code" class="html">redirect 301 /wp-commentrss2.php http://your-domain.com/feed
redirect 301 /wp-atom.php http://your-domain.com/feed
redirect 301 /wp-rss2.php http://your-domain.com/feed
redirect 301 /wp-rss.php http://your-domain.com/feed
redirect 301 /feed/atom http://your-domain.com/feed
redirect 301 /feed/rss2 http://your-domain.com/feed
redirect 301 /feed/rss http://your-domain.com/feed
redirect 301 /feed/rdf http://your-domain.com/feed
redirect 301 /rss.php http://your-domain.com/feed
redirect 301 /feeds http://your-domain.com/feed
redirect 301 /rss http://your-domain.com/feed</pre></div><p><strong>Example 2</strong> .htaccess files redirects &#8211; This redirects all Feed URLs, comment, category, archive, and post feeds into one central location. This is what I use on technerdia.com &#8211; If you add /feed to the end of this post, it will redirect you to my root feed: technerdia.com/feed</p><div
class="mycode"><pre name="code" class="html">redirect 301 /wp-commentrss2.php http://your-domain.com/feed
redirect 301 ^/(.*)/feed$ http://your-domain.com/feed
redirect 301 /wp-atom.php http://your-domain.com/feed
redirect 301 /wp-rss2.php http://your-domain.com/feed
redirect 301 /wp-rss.php http://your-domain.com/feed
redirect 301 /feed/atom http://your-domain.com/feed
redirect 301 /feed/rss2 http://your-domain.com/feed
redirect 301 /feed/rss http://your-domain.com/feed
redirect 301 /feed/rdf http://your-domain.com/feed
redirect 301 /htmlfeed http://your-domain.com/feed
redirect 301 /comments http://your-domain.com/feed
redirect 301 /rss.php http://your-domain.com/feed
redirect 301 /feeds http://your-domain.com/feed
redirect 301 /rss http://your-domain.com/feed</pre></div><p><strong>Example3</strong>: Using the above redirects in the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvcmVkaXJlY3Rpb24v" target=\"_blank\" rel=\"nofollow\">Redirection Plugin</a>.</p><div
class="mycode"><pre name="code" class="html">/wp-commentrss2.php /feed
^/(.*)/feed$ /feed
/wp-atom.php /feed
/wp-rss2.php /feed
/wp-rss.php /feed
/feed/atom /feed
/feed/rss2 /feed
/feed/rss /feed
/feed/rdf /feed
/htmlfeed /feed
/comments /feed
/rss.php /feed
/feeds /feed
/rss /feed</pre></div><hr
size="1" /><h2>Step 6:</h2><h3>Swapping Out Feed URL&#8217;s In Feedburner &amp; Turning Off Services</h3><p>Not everyone will need to do this&#8230;. If you&#8217;re just putting an update notice into your current feed and waiting for the change to happen naturally, ignore the step.</p><ol><li>For everyone else, you need to change the Feed URL in your Feedburner account AND shut off the extra features, like pinging.</li><li>Log into your Feedburner account and click on the Feed in question.</li><li>Then, click on the Publicize Tab and shut off Ping Shot and Socialize options.</li><li>Then click the &#8220;Edit Feed Details&#8221; link at the top and change the URL, to the Temporary RSS Feed that we created in Step 3.</li><li>Mine is set to: <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC94bWwvcnNzLXRuLnhtbA==" target=\"_blank\" rel=\"nofollow\">http://technerdia.com/search/xml/rss-tn.xml</a></li></ol><hr
size="1" /><h2>Step 7:</h2><h3>Check Your Work!</h3><p>It&#8217;s time to ensure everything is working before we proceed. Visually check your Feedburner URL in the browser to see if it has updated, then check it in a Reader by adding a new record to make sure it displays correctly. The new temporary RSS Feed Notice should appear or your RSS Footer notice to update the Feed URL.</p><ul><li>Repeat the same steps with your new Feed URL. Make sure the Websites updates appear and that the RSS Footer notice is showing up.</li><li>Check Feed Statistics by clicking on the Feed Menu link &gt; Top Feeds link option to see if Subscribers are showing up. It will take a few days for it to settle down.</li></ul><hr
size="1" /><h2>Step 8:</h2><h3>Update Your Websites</h3><p>Oh the tasks of tasks! It&#8217;s not just Templates it&#8217;s also Widgets.</p><p>FTP to your theme, download the entire theme, open every PHP file in a Text Editor like <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5mbG9zLWZyZWV3YXJlLmNoL25vdGVwYWQyLmh0bWw=" target=\"_blank\" rel=\"nofollow\">Notepad 2</a>. Find &amp; Replace (Edit &gt; Replace or CTRL+H) your Feedburner URL with your Sites default/new Feed URL.</p><p><strong>Do this for every template, once done upload the templates back</strong>.</p><ul><li>Enter your WordPress Admin &gt; Appearance Menu &gt; Widgets. Open your Widgets Areas and view the Widgets. Scan through each (Normally Text &amp; PHP Widgets) and find/replace the Feedburner URL with your new Feed URL.</li><li>Refresh Your Cache.</li></ul><hr
size="1" /><h2>Step 9:</h2><h3>Update the Social Networks &amp; Online Services</h3><p>Many of us have socialized our Feedburner URLs, pinged them, posted them, done all types of stuff with the URL. So first, update your Social Networks from Step #1 1/2 then hunt down every other Social Network or Service that you may have used your Feedburner URL on and replace it with your new pimpin Feed URL.</p><p><em>This task may extend far past today&#8217;s duties depending on what you&#8217;ve done with your Feedburner URL.</em></p><hr
size="1" /><h2>Step 10:</h2><h3>Down The Road</h3><p>I can&#8217;t think of a reason to ever delete your Feedburner feed, unless it&#8217;s fully dead. As the months roll by you should change out the notice to update the Feed URL, maybe add a Video notice in. The final update that I do, will include a self promo landing page within the Feed. If anyone happens to find it, at least I know they&#8217;ll get what I feel is important, some marketing, and information on how to update Feed URLs.</p><hr
size="1" /><p><strong>That&#8217;s It!!!</strong><br
/> I tried to be as detailed as possible with the steps I took&#8230; This may seem like a lot of work, but really it isn&#8217;t bad. I was able to set up and swap out 10 sites Feeds in less than an hour, once you do it once, it&#8217;s a snap after that.</p><hr
/><h4>Have a comment, corrections, improvements or feedback?</h4><p>Let me know in the <a
href="#comments">comments</a> below or <a
href="http://technerdia.com/feedback.html">send me feedback</a> directly.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzUyNF9yZW1vdmluZy1mZWVkYnVybmVyLmh0bWw=">10 Steps to Replacing Feedburner With Your Own Feed URL &#8211; with Statistics</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=524" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/524_removing-feedburner.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Twitter Tools &#8211; Tracking followers that quit following you. [Revised]</title><link>http://technerdia.com/180_twitter-tracking.html</link> <comments>http://technerdia.com/180_twitter-tracking.html#comments</comments> <pubDate>Wed, 30 Mar 2011 16:00:36 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Online Tools]]></category> <category><![CDATA[bot]]></category> <category><![CDATA[social]]></category> <category><![CDATA[social networking tool]]></category> <category><![CDATA[twitter]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=180</guid> <description><![CDATA[The 10 Best and Free Twitter Follower Trackers Online!<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/180_twitter-tracking.html">Twitter Tools &#8211; Tracking followers that quit following you. [Revised]</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>Everyone has a different reason to manage the followers they have gained on Twitter. Knowing this, I set out to find a range of Twitter Follower Trackers, Follower Managers, and overall Twitter Statistics Tools that would not only help with my own needs, but yours as well.<p>What I found was 10 of the best and free Twitter Tools (some have feature upgrades) that help you maintain or manage your Twitter Following, some way or another. From finding and getting notified of lost followers, to management tools that help group &amp; maintain your those you follow you and you follow as well, and even statistics with graphs that break down every aspect of your Twitter account.<ul><li>The links below will all open in a  new tab/window.</li></ul> <br
/><h2>Qwitter &#8211; Catching Twitter Quitters</h2><p>Qwitter sends you a summary email at least once a day informing you of those who have stopped following you on Twitter!<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3VzZXF3aXR0ZXIuY29tLw==" target=\"_blank\"><img
src="http://technerdia.com/files/1_followers-qwitter.gif" alt="Qwitter - UseQwitter- Catching Twitter Quitters" width="600" height="125" class="aligncenter size-full wp-image-503" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3VzZXF3aXR0ZXIuY29tLw==" target=\"_blank\">Visit UseQwitter.com</a> ]</div><h2>MyTweeple &#8211; Relationship Management</h2><p>Manage all your Twitter people in one place, easily track who you&#8217;re following and who&#8217;s following you back.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL215dHdlZXBsZS5jb20v" target=\"_blank\"><img
src="http://technerdia.com/files/2_followers-mytweeple-.gif" alt="MyTweeple - Relationship Management" width="600" height="125" class="aligncenter size-full wp-image-504" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL215dHdlZXBsZS5jb20v" target=\"_blank\">Visit MyTweeple.com</a> ]</div><h2>Friend or Follow &#8211; Who is Following You Back?</h2><p>Quickly and very easily show who&#8217;s following you back, who&#8217;s not following you, and who your friends are on Twitter.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyaWVuZG9yZm9sbG93LmNvbS8=" target=\"_blank\"><img
src="http://technerdia.com/files/3_followers-friend-follow-.gif" alt="Friend or Follow - Who&#039;s Following You Back?" width="600" height="125" class="aligncenter size-full wp-image-505" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyaWVuZG9yZm9sbG93LmNvbS8=" target=\"_blank\">Visit FriendOrFollow.com</a> ]</div><h2>Who Unfollowed Me</h2><p>Web-based Twitter App allows you to track your unfollowers in real-time without DM or eMail notices.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3doby51bmZvbGxvd2VkLm1lLw==" target=\"_blank\"><img
src="http://technerdia.com/files/4_followers-unfollowed.gif" alt="Who Unfollowed Me" width="600" height="125" class="aligncenter size-full wp-image-506" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3doby51bmZvbGxvd2VkLm1lLw==" target=\"_blank\">Visit Who.Unfollowed.Me</a> ]</div><h2>Twitter Counter &#8211; Twitter Statistics</h2><p>Twitter Counter provides statistics of Twitter usage and tracks over 14 million users and counting.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXJjb3VudGVyLmNvbS90cmliYWxOZXJk" target=\"_blank\"><img
src="http://technerdia.com/files/5_followers-counter.gif" alt="Twitter Counter - Twitter Statistics" width="600" height="125" class="aligncenter size-full wp-image-507" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3aXR0ZXJjb3VudGVyLmNvbS90cmliYWxOZXJk" target=\"_blank\">Visit TwitterCounter.com</a> ]</div><h2>Refollow &#8211; Twitter Social Circle</h2><p>Refollow helps you discover, manage, and protect your Twitter social circle.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3JlZm9sbG93LmNvbS9yZWZvbGxvdy9pbmRleC5odG1s" target=\"_blank\"><img
src="http://technerdia.com/files/6_followers-refollow.gif" alt="Refollow - Discover your Twitter social circle" width="600" height="125" class="aligncenter size-full wp-image-508" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3JlZm9sbG93LmNvbS9yZWZvbGxvdy9pbmRleC5odG1s" target=\"_blank\">Visit ReFollow.com</a> ]</div><h2>TwerpScan &#8211; Twitter Contact Management</h2><p>List and sort your followers and friends, up to 100 at a time. Follow, unfollow or block contacts right on the spot.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3ZXJwc2Nhbi5jb20v" target=\"_blank\"><img
src="http://technerdia.com/files/8_followers-twerpscan.gif" alt="TwerpScan - Twitter contact management" width="600" height="125" class="aligncenter size-full wp-image-510" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3R3ZXJwc2Nhbi5jb20v" target=\"_blank\">Visit TwerpScan.com</a> ]</div><h2>TwitterLeague &#8211; Group Your Twitter Followers</h2><p>Group your users, see who has more followers, who updates the most, who follows the most people, and more&#8230;<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dzEudHdpdHRlcmxlYWd1ZS5jb20v" target=\"_blank\"><img
src="http://technerdia.com/files/9_followers-league.gif" alt="Group Your Twitter Followers" width="600" height="125" class="aligncenter size-full wp-image-511" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dzEudHdpdHRlcmxlYWd1ZS5jb20v" target=\"_blank\">Visit TwitterLeague.com</a> ]</div><h2>ChirpStats &#8211; Keep Track of Your Followers</h2><p>To use chirpstats, simply follow @chirpstats on Twitter and we will message you with your first update in a couple of days!<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NoaXJwc3RhdHMuY29tLw==" target=\"_blank\"><img
src="http://technerdia.com/files/10_followers-chirpstats.gif" alt="Twitter follower analytics package" width="600" height="125" class="aligncenter size-full wp-image-512" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NoaXJwc3RhdHMuY29tLw==" target=\"_blank\">Visit ChirpStats.com</a> ]</div><h2>Does Follow</h2><p>Simple as it gets, check if User1 followers User2.<br
/> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2RvZXNmb2xsb3cuY29tLw==" target=\"_blank\"><img
src="http://technerdia.com/files/11_followers-doesfollow.gif" alt="Does Follow - Does user1 follow user2?" width="600" height="125" class="aligncenter size-full wp-image-513" style="border:1px solid #333" /></a></p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2RvZXNmb2xsb3cuY29tLw==" target=\"_blank\">Visit DoesFollow.com</a> ]</div><h2>Bonus Tool &#8211; Tweet Adder</h2><p><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC90bi8/bD10d2VldGFkZGVy" target=\"_blank\">TweetAdder</a> isn&#8217;t exactly a follower management tool, it&#8217;s more of a follower getter that helps maintain your following for you. The tool acts like a human doing the Twitter work over the Web. From logging into twitter, following and unfollowing users, and tweeting for you&#8230; The feature list is rather extensive, and the key factor is, it&#8217;s all done from the Web.</p><p>While I only recently started using <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC90bi8/bD10d2VldGFkZGVy" target=\"_blank\">TweetAdder</a>, I use it on all of my Accounts. So far, it appears to add roughly 600-1000 new followers a month, and I&#8217;m using conservative settings. If you&#8217;re worried about the quality of users, you can load them yourself, use the search, or follow another users followers or lists. And you can apply filters to remove some users.</p><p>I&#8217;ve used several paid twitter tools, this is the only one I&#8217;ve ever needed, I just wish it was around a few years back. Mix it with a few of the totally free tools above, and you&#8217;ve got the best twitter weapon combo you can get!</p><p><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC90bi8/bD10d2VldGFkZGVy" target=\"_blank\"><img
src="http://technerdia.com/files/7_followers-tweetadder.gif" alt="Tweet Adder" width="600" height="200" class="aligncenter size-full wp-image-515" style="border:1px solid #333" /></a></p><p>* Yes, that&#8217;s my <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC90bi8/bD10d2VldGFkZGVy" target=\"_blank\">TweetAdder</a> affiliate link, yes if you purchase through that link I may earn a commission. And if you do, hit me up, I&#8217;ll gladly assist if you have any questions!</p><div
align="center" style="margin-bottom:75px">[ <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL3NlYXJjaC90bi8/bD10d2VldGFkZGVy" target=\"_blank\">Get More Details Today</a> ]</div> <br
/><br
/><hr
/><h4>Enjoy this article? Hate it? Find an error?</h4><p>Let me know in the <a
href="#comments">comments</a> below or if comments are not open <a
href="http://technerdia.com/feedback.html">drop me feedback directly</a>!!!</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzE4MF90d2l0dGVyLXRyYWNraW5nLmh0bWw=">Twitter Tools &#8211; Tracking followers that quit following you. [Revised]</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=180" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/180_twitter-tracking.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>WP Function that protects your wp-login.php with PHP Auth [UPDATED]</title><link>http://technerdia.com/313_wp-login-protection.html</link> <comments>http://technerdia.com/313_wp-login-protection.html#comments</comments> <pubDate>Mon, 21 Mar 2011 14:15:29 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Security]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[function]]></category> <category><![CDATA[htaccess]]></category> <category><![CDATA[php]]></category> <category><![CDATA[security]]></category> <category><![CDATA[wp]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=313</guid> <description><![CDATA[A simple WP Function that password protects the wp-login.php file on Wordpress setups.<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/313_wp-login-protection.html">WP Function that protects your wp-login.php with PHP Auth [UPDATED]</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p><img
src="http://technerdia.com/files/protect-wp-login.gif" alt="Protect Your WordPress Login Page" width="250" height="250" class="alignleft size-full wp-image-326" />The Function below adds a simple layer of security to your WordPress Websites. When anyone visits the wp-login.php page an authentication window will pop prompting the visitor to enter a Username and Password before they can access the wp-login.php file.</p><p>This is a simple protection solution for any WordPress site with Registrations turned off and for sites with very few or only one person that manages them.</p><p>Place the function below into your functions.php file for each WordPress Theme/site that you want to protect. Swap out the YOUR-USERNAME and YOUR-PASSWORD with your user/pass info, and it&#8217;s ready to go!</p><div
class="mycode"><pre name="code" class="php">
 if ( $_SERVER['PHP_SELF'] == "/wp-login.php" ) { add_action( 'init', 'login_init' ); /* Do Action */ }
function login_init() {
 $user = "YOUR-USERNAME";
 $pass = "YOUR-PASSWORD";
  get_option('get_header');
if( $_SERVER['PHP_AUTH_USER'] != $user &#038;&#038; $_SERVER['PHP_AUTH_PW'] != $pass ) {
    header("WWW-Authenticate: Basic realm=""");
    header("HTTP/1.0 401 Unauthorized");
exit;
  }
}
</pre></div><h2>Version 2</h2><p>If the above example works, but a correct username &amp; password doesn&#8217;t seem to be accepted, the issue might be that PHP can not access the PHP_AUTH_USER and PHP_AUTH_PW functions.</p><p>To correct this you&#8217;ll need use a RewriteRule.</p><h2>The RewriteRule</h2><p>Use ONE of the following RewriteRules in your Websites root .htaccess file. I do not fully understand this rule, but it appears that:</p><blockquote>The PHP_AUTH_USER and PHP_AUTH_PW functions and values of them, when entered into the auth box, is loaded into a variable called HTTP_AUTHORIZATION. The PHP afterward then gets the PHP_AUTH_USER and PHP_AUTH_PW values by accessing the HTTP_AUTHORIZATION variable.</blockquote><p>** Test your Website after adding the rewrite rule. Posts, Pages and Images will 404 if you have the incorrect one.</p><p><strong>Worked On WordPress Multisite</strong> &#8211; Put the Rule directly below <i>RewriteEngine On</i> line, within the .htaccess file of your Website.</p><div
class="mycode"><pre name="code" class="php">RewriteRule .? - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</pre></div><p><strong>Other Possible RewriteRules</strong>: The first RewriteRule below is the most common use rule.</p><div
class="mycode"><pre name="code" class="html">RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]</pre></div><div
class="mycode"><pre name="code" class="html">RewriteEngine On
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]</pre></div><div
class="mycode"><pre name="code" class="html">RewriteEngine On
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]</pre></div><p><strong>The Code</strong><br
/> Place the function below into your functions.php file for each WordPress Theme/site that you want to protect. Swap out the YOUR-USERNAME and YOUR-PASSWORD with your user/pass info.</p><div
class="mycode"><pre name="code" class="php">
if ( $_SERVER['PHP_SELF'] == "/wp-login.php" ) {
    add_action( 'init', 'login_init' );
}
function login_init() {
    $user = "YOUR-USERNAME";
    $pass = "YOUR-PASSWORD";
    get_option('get_header');
    list( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) = explode( ':', base64_decode( substr( $_SERVER['HTTP_AUTHORIZATION'], 6 ) ) );
    if ( $user == $_SERVER['PHP_AUTH_USER'] &#038;&#038; $pass == $_SERVER['PHP_AUTH_PW'] ) {
        header('WWW-Authenticate: Basic realm=""');
        header("HTTP/1.0 401 Unauthorized");
        echo '';
        exit;
    }
 }</pre></div><ul><li>You can use the same username and password for each site, however I recommend each site has at least a unique password.</li><li>Do Not use the same username and password that you use to access the WordPress Admin.</li><li>Don&#8217;t forget to sometimes change your username and passwords up.</li><li>Use Password <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzI4NF9wYXNzd29yZC1tYW5hZ2VyLmh0bWw=">Management Software like KeePass</a> to manage your passwords.</li><li>Remember, this is simply an extra layer of security, it for sure is NOT a solid solution for protection &#8211; you should still select a very complex master username and password to access the Admin along with other WordPress Security Plugins.</li></ul><hr
/><h4>If this article helped you then please post a comment below and let me know!</h4><p>I would love to hear from you in the <a
href="#comments">comments</a> below or if comments are not open <a
href="http://technerdia.com/feedback.html">send me feedback</a> directly.</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzMxM193cC1sb2dpbi1wcm90ZWN0aW9uLmh0bWw=">WP Function that protects your wp-login.php with PHP Auth [UPDATED]</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=313" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/313_wp-login-protection.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Best Password Manager for Windows &#8211; Mac &#8211; Linux / Ubuntu &#8211; Smart Phones and more&#8230;</title><link>http://technerdia.com/284_password-manager.html</link> <comments>http://technerdia.com/284_password-manager.html#comments</comments> <pubDate>Wed, 16 Mar 2011 22:37:52 +0000</pubDate> <dc:creator>tribalNerd</dc:creator> <category><![CDATA[Software Guides]]></category> <category><![CDATA[encryption]]></category> <category><![CDATA[manager]]></category> <category><![CDATA[passwords]]></category> <category><![CDATA[security]]></category> <guid
isPermaLink="false">http://technerdia.com/?p=284</guid> <description><![CDATA[When it comes to kick butt tools, this tool wins hands down<p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/284_password-manager.html">The Best Password Manager for Windows &#8211; Mac &#8211; Linux / Ubuntu &#8211; Smart Phones and more&#8230;</a></li><li><b>By:</b> <a
href="https://plus.google.com/105408082571454010152/?rel=author" target="_blank">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/" target="_blank">techNerdia - Web Development Tips</a></li><li><b><a
href="https://plus.google.com/u/0/108046225913965315594/posts" target="_blank">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> ]]></description> <content:encoded><![CDATA[<p>When it comes to kick butt little tools, <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2tlZXBhc3MuaW5mby8=" target=\"_blank\">KeePass</a> wins hands down!</p><blockquote><p>This tool has changed how I use my computer, my browsers and even how I plan for vacations.</p></blockquote><p><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2tlZXBhc3MuaW5mby8=" target=\"_blank\"><img
src="http://technerdia.com/files/KeePass.gif" alt="KeePass" width="116" height="125" class="alignleft size-full wp-image-288" /></a><strong>What is KeePass?</strong> Simply, it&#8217;s a very secure password manager, that can group your passwords together for easy management. And it works on just about everything, Windows of all flavors, Smart Devices like the iPhone, Droids, BlackBerry&#8217;s, and so on&#8230; Linux/Unbuntu, Mac OS X, I&#8217;m probably missing a few. It&#8217;s light weight, simple to use, has a movable database&#8230; truly, it rocks.</p><p>Other than Google, every Password I have is no longer stored in my browser. I keep everything, from the web, ftp, shell, database and client secure details in my KeePass.</p><ul><li>I only have one password to remember, and that&#8217;s to KeePass.</li><li>I use KeePass to generate long random passwords for me.</li><li>No site, service or feature has the same password.</li></ul><h2>Downloading Keepass: <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2tlZXBhc3MuaW5mby9kb3dubG9hZC5odG1s" target=\"_blank\">http://keepass.info/</a></h2><p>The options are the Classic Edition and Professional Edition. The Pro Edition requires MS .NET Framework&#8230;. I downloaded the <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2tlZXBhc3MuaW5mby9kb3dubG9hZC5odG1s" target=\"_blank\">Classic Edition</a>. Choose either, or go with the Classic if you&#8217;re not sure which one to choose.</p><h2>Installing KeePass</h2><p>KeePass is portable, it doesn&#8217;t make registry changes and runs without special libraries. You can place it on a USB drive and even run it on a public machine all without installing anything.</p><h2>Setting up KeePass</h2><p>Once you run KeePass it will ask you to create a database and Composite Master Key, which I recommend doing for Security reasons. You have two things to remember here, your Master Password (so select a strong one) and the location to where you save the Database.kdb and pwsafe.key files.</p><ul><li>Be sure to backup your Database.kdb and pwsafe.key files once you&#8217;ve populated them with account details.</li><li>Your pwsafe.key file may be hidden on your Computer depending on your OS and setup. You may need to unhide important files before you can copy the key file for a backup.<li></ul><h2>Running KeePass</h2><p>Once you start KeePass, enter your Master Password and select your Key. The software can be a bit confusing at first, but a couple features cover most of your needs.</p><p>First is Groups, groups simply group your accounts/passwords together. I have groups for my clients (with sub-groups inside of it), affiliate programs, social networks, tools, forums, etc.</p><p><img
src="http://technerdia.com/files/KeePass-groups.gif" alt="KeePass Groups Example" width="296" height="72" class="aligncenter size-full wp-image-292" /></p><ul><li><strong>To create a group</strong>: Click the Edit link at the top, then select Add Group</li></ul><p><img
src="http://technerdia.com/files/KeePass-add-entry.gif" alt="KeePass Add Entry Example" width="112" height="28" class="alignright size-full wp-image-294" /> The next feature is Adding an Entry. On the main toolbar, it&#8217;s the 4th icon. If you mouse over it, it says Add Entry. Clicking Add Entry brings up a window to enter the details. Everything here is self explanatory other than maybe the Password Generator.</p><ul><li><strong>To add an entry</strong>: Click the 4th icon in the main menu (Add Entry) or access the Edit link at the top, then select Add Entry.</li></ul><p>Every new entry gets a fresh new password, click the icon to the right of the Password box to expose the password, for copying or pasting in a new password.</p><p><img
src="http://technerdia.com/files/KeePass-passwords.gif" alt="KeePass Password Manager" width="194" height="51" class="aligncenter size-full wp-image-295" /></p><p>If you want to generate a new password, click the Keys Icon to the right of the Repeat Password box. At the bottom of the window, click the Generate button to create a new password. It&#8217;s instantly copied over to the entries password field.</p><h2>Maintaining Entries</h2><p>Each entry can be dragged into groups. So if the entry is created in the wrong spot, simply select and drag it to the proper location.</p><p>To View or Edit an Entry, right click on the Entry and select Edit/View Entry. Use this same menu to delete or duplicate an entry.</p><h2>Creating Multiple Databases For Others To Access</h2><p>Does your Computer get used by your spouse, kids or staff? Then no worries&#8230; In the main menu, click the New Icon (first icon). Set a new Master Key then your Password. Now everyone can have a unique way to access PassKeep to store passwords.</p><p>My spouse uses her own Master Key File while my kids just have a Password enter with no Key File to select. It&#8217;s hard enough to get children to use this software, so cut out every step you can that may push them away from using it, every time!</p><ul><li>Backup your database and key file before doing this.</li></ul><h2>KeePass Settings</h2><p>To access the Settings open the Tools Menu at the top, then click on Options. Setting up the software is really more about how you want to use it&#8230;</p><ul><li><strong>Security</strong>: I have two fields unchecked, the 3rd (Lock wordpress) and the last (expire entries) &#8211; the others are all checked.</li><li><strong>Interface (GUI)</strong>: The two key settings here for me are the Minimize and [x] close selections. I have both selected. Instead of the software closing, it goes to my system tray, when I open it &#8211; I have to enter my Master Password, just like I would if the software was fully closed.</li><li>I didn&#8217;t modify any other settings past these&#8230;. I do suggest you read through the other tabs &amp; features to ensure the settings are set how you like.</li></ul><h2>Vacation Time</h2><p><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tL2ZpbGVzL3ZhY2F0aW9uX21leGljb18yLmpwZw==" target=\"_blank\" title=\"Vacation in Mexico\"><img
src="http://technerdia.com/files/vacation_mexico_1.jpg" alt="Vacation in Mexico" width="193" height="250" class="alignleft size-full wp-image-298" /></a>I always take a note pad and pen with me when I travel. Every time before traveling, I would write down the most important login details, passwords, and even url&#8217;s. No worries, I used my own form of encryption to mask things.</p><p>Today though&#8230; I just grab a copy of KeePass, my Database and Key file and put them on a flash drive and I burn a CD to toss in with my suitcase as a backup. I also put the information in a zip file on my server, within a password protected directory.</p><p>No longer do I worry about losing my note pad, backup paper in my wallet or what actually happened the most, I forgot to write down a password to something important&#8230;. I&#8217;m very happy to say, those worries are now gone.</p> <br
/><h3>KeePass</h3><p>It&#8217;s here to stay&#8230; It&#8217;s used daily, it&#8217;s used by family members, it&#8217;s even used on vacations. You should be using <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2tlZXBhc3MuaW5mby8=" target=\"_blank\">KeePass</a> as well.</p><p><strong>Proper security starts and ends with you!</strong></p><hr
/><h4>Enjoy this article? Hate it? Find an error?</h4><p>Let me know in the <a
href="#comments">comments</a> below or if comments are not open <a
href="http://technerdia.com/feedback.html">drop me feedback directly</a>!!!</p><br
/><p><div
style="border-top:1px dotted #cccccc;clear:both;font-size:14px;font-weight:bold;margin:2px 10px;padding:0 10px;text-align:left;"><ul><li><b>Reading:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLzI4NF9wYXNzd29yZC1tYW5hZ2VyLmh0bWw=">The Best Password Manager for Windows &#8211; Mac &#8211; Linux / Ubuntu &#8211; Smart Phones and more&#8230;</a></li><li><b>By:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vMTA1NDA4MDgyNTcxNDU0MDEwMTUyLz9yZWw9YXV0aG9y" target=\"_blank\">tribalNerd</a></li><li><b>From:</b> <a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3RlY2huZXJkaWEuY29tLw==" target=\"_blank\">techNerdia - Web Development Tips</a></li><li><b><a
href="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9wbHVzLmdvb2dsZS5jb20vdS8wLzEwODA0NjIyNTkxMzk2NTMxNTU5NC9wb3N0cw==" target=\"_blank\">Follow techNerdia on Google+</a></li></ul></div><p
align="center">~ <b>Thank you for subscribing to techNerdia.com - Please Share This Post With Others</b> ~</p></p> <img
src="http://technerdia.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=284" width="1" height="1" style="display: none;" />]]></content:encoded> <wfw:commentRss>http://technerdia.com/284_password-manager.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
