<?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>wordpress programming - WP2X</title> <atom:link href="https://wp2x.com/tag/wordpress-programming/feed/" rel="self" type="application/rss+xml" /><link>https://wp2x.com</link> <description>We can help your Wordpress faster</description> <lastBuildDate>Sat, 26 Dec 2015 14:39:02 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> <generator>https://wordpress.org/?v=5.6.17</generator> <item><title>.htaccess redirection tips</title><link>https://wp2x.com/htaccess-redirection-tips/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Sat, 26 Dec 2015 14:39:02 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[wordpress html]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=425</guid><description><![CDATA[<p>.htaccess is very powerful. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all. Since .htaccess is a hidden system file, please make sure your FTP client is configured to show hidden files. This is usually an option in the program&#8217;s preferences/options. Let&#8217;s do these ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/htaccess-redirection-tips/">.htaccess redirection tips</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>.htaccess is very powerful. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all.<span
id="more-425"></span></p><p><img
loading="lazy" class="aligncenter size-full wp-image-426" src="http://wp2x.com/wp-content/uploads/2015/12/illu_htaccess.gif?4b2a2c&amp;4b2a2c" alt="illu_htaccess" width="300" height="300" /></p><p>Since .htaccess is a hidden system file, please make sure your FTP client is configured to show hidden files. This is usually an option in the program&#8217;s preferences/options.</p><p>Let&#8217;s do these step to create a redirection by .htaccess file.</p><h2>1. Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.</h2><h2>2. Edit the contents of the file. Check the following examples:</h2><p>301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the &#8220;mt-example.com&#8221; domain:</p><pre class="lang:default decode:true "># This allows you to redirect your entire website to any other domain
Redirect 301 / http://mt-example.com/</pre><p>302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:</p><pre class="lang:default decode:true "># This allows you to redirect your entire website to any other domain
Redirect 302 / http://mt-example.com/</pre><p>Redirect index.html to a specific subfolder:</p><pre class="lang:default decode:true "># This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/

Redirect an old file to a new file path:

# Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
Redirect to a specific index page:

# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html</pre><h2>3. Upload this file and re-name it to .htaccess</h2><p>MORE POWERFUL URL CHANGES WITH MOD_REWRITE</p><p>If you need to make complex changes to the way your URL displays, you should visit Using .htaccess rewrite rules. You can do things like add &#8220;www&#8221; to the beginning of your URL, redirect all requests to a subfolder but keep the rest of the URL, etc.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/htaccess-redirection-tips/">.htaccess redirection tips</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>How to enable Gzip in .Htaccess for WordPress?</title><link>https://wp2x.com/how-to-enable-for-wordpress/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 18 Nov 2015 10:37:19 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress tips]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=421</guid><description><![CDATA[<p>In case you have not heard of it in the past, Gzip is a server process that essentially compresses your files on the fly before transmission to the user. It is primarily used to compress text files such as HTML, CSS, and JavaScript with impressive results. Take the 90KB Mootools framework for example, Gzip reduces ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/how-to-enable-for-wordpress/">How to enable Gzip in .Htaccess for WordPress?</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>In case you have not heard of it in the past, Gzip is a server process that essentially compresses your files on the fly before transmission to the user. <span
id="more-421"></span>It is primarily used to compress text files such as HTML, CSS, and JavaScript with impressive results. Take the 90KB Mootools framework for example, Gzip reduces it to 26KB saving the visitor time and your bandwidth.</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/11/gzip3d.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-422" src="http://wp2x.com/wp-content/uploads/2015/11/gzip3d.png?4b2a2c&amp;4b2a2c" alt="gzip3d" width="299" height="198" /></a></p><pre class="lang:ini decode:true ">#Gzip
&lt;ifmodule mod_deflate.c&gt;
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
&lt;/ifmodule&gt;
#End Gzip</pre><p>If your hosting setup has Gzip enabled I highly recommend that you enable it in your .htaccess file by copying and pasting the above code into your .htaccess. If they don&#8217;t have it enabled, simply ask, most of the time they will simply enable it for you. It also comes recommended by Google and <a
href="http://developer.yahoo.com/performance/rules.html#gzip" target="_blank">Yahoo</a>.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/how-to-enable-for-wordpress/">How to enable Gzip in .Htaccess for WordPress?</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Free wordpress theme AccessPress Root</title><link>https://wp2x.com/free-wordpress-theme-accesspress-root/</link> <comments>https://wp2x.com/free-wordpress-theme-accesspress-root/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 12 Aug 2015 10:16:51 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Themes]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress theme]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=410</guid><description><![CDATA[<p>Today I will show you a totally free responsive wordpress theme AccessPress Root with minimal and useful features AccessPress Root is a simple, clean, beautifully designed responsive WordPress business theme with drag and drop homepage sections. &#160; Its minimal but mostly used features will help you setup your website easily and quickly. Full width and ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/free-wordpress-theme-accesspress-root/">Free wordpress theme AccessPress Root</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Today I will show you a totally free responsive wordpress theme AccessPress Root with minimal and useful features<span
id="more-410"></span></p><p>AccessPress Root is a simple, clean, beautifully designed responsive WordPress business theme with drag and drop homepage sections.</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/08/screenshot-e1439374454818.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-412" src="http://wp2x.com/wp-content/uploads/2015/08/screenshot-e1439374454818.png?4b2a2c&amp;4b2a2c" alt="screenshot" width="600" height="450" /></a></p><p>&nbsp;</p><p>Its minimal but mostly used features will help you setup your website easily and quickly. Full width and boxed layout, featured slider, featured posts, services/features/projects layout, testimonial layout, blog layout, social media integration, call to action and many other page layouts.</p><p>Fully responsive, WooCommerce compatible, bbPress compatible, translation ready, cross-browser compatible, SEO friendly, RTL support.</p><p>AccessPress Root is multi-purpose and is suitable for any type of business. Highest level of compatibility with mostly used WP plugins.</p><p>Demo: <a
href="http://demo.accesspressthemes.com/accesspress-root" target="_blank">http://demo.accesspressthemes.com/accesspress-root</a></p><p>Download Free <strong>AccessPress Root theme </strong>with this form<div
class="freebie-sub-box"><div
class="freebie-sub-inner"><h3>Please enter your email and get it now!</h3><p>Simply enter your email address and the download link will be sent right to your email box.</p><form
class="freebie-sub-form"><div
class="replaceArea"><div
class="replaceArea-error"></div><center> <input
type="text" onblur="if(this.value=='')this.value='Email Address';" onfocus="if(this.value=='Email Address')this.value='';" value="Email Address" name="email" class="name"> <input
type="submit" value="Download" class="freebie-submit"></center> <input
type="hidden" name="id" id="id" value="aHR0cHM6Ly93b3JkcHJlc3Mub3JnL3RoZW1lcy9hY2Nlc3NwcmVzcy1yb290Lw=="></div></form></div></div><p>The post <a
rel="nofollow" href="https://wp2x.com/free-wordpress-theme-accesspress-root/">Free wordpress theme AccessPress Root</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/free-wordpress-theme-accesspress-root/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Security tips for WordPress</title><link>https://wp2x.com/security-tips-for-wordpress/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 23 Jul 2015 10:45:20 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[security]]></category> <category><![CDATA[wordpress optimization]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=398</guid><description><![CDATA[<p>There are a lot of risks from internet for a webmaster to maintain their website, but with wordpress it &#8216;s easy to do the basic security, today I will share you 3 wordpress security tips what always need for any wordpress site. &#160; 1. WordPress security with daily backup No one can guarantee their website ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/security-tips-for-wordpress/">Security tips for WordPress</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>There are a lot of risks from internet for a webmaster to maintain their website, but with wordpress it &#8216;s easy to do the basic security, today I will share you 3 wordpress security tips what always need for any wordpress site.<span
id="more-398"></span></p><p>&nbsp;</p><h2><img
loading="lazy" class="aligncenter size-full wp-image-399" src="http://wp2x.com/wp-content/uploads/2015/07/Wordpress-Security-Plugins.jpg?4b2a2c&amp;4b2a2c" alt="Wordpress-Security-Plugins" width="570" height="300" srcset="https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Security-Plugins.jpg 570w, https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Security-Plugins-300x158.jpg 300w" sizes="(max-width: 570px) 100vw, 570px" /></h2><h2>1. WordPress security with daily backup</h2><p>No one can guarantee their website is secured 100% so that let &#8216;s prepare a backup version daily via your hosting plan. Almost hosting service provide daily backup service include files and database. Just one-click to restore if you meet any risk later on. This way will make sure you are safe 100%.</p><h2>2. Internet activity security</h2><p><strong>1. Use A Secure Network At Home</strong> – If you are using Wifi at your home or office, then I would suggest setting up a private WPA2 network with a strong, randomly-generated name and network passphrase. For additional protection, you can employ “security through obscurity” methods such as enabling MAC Address Filtering.<br
/> <strong>2. Use An Encrypted VPN Connection Over Public Wifi</strong> – Generally speaking, it’s best to never log in to a sensitive area such as your WordPress Dashboard when connected to the internet over public Wifi. If you are using your laptop or phone over a public network, always run your connection through an encrypted VPN and make sure that you are signing in to your website over SSL. You can purchase a VPN from StrongVPN.com.</p><h2>3. Securing Your Personal Computer</h2><p>If I can recommend, I recommend you use Linux or Mac to anti virus. In windows I usually meet the key logger software what can&#8217;t be detected by any anti virus software. It &#8216;s a lot of risk if you lose server account and email accounts.</p><p>But anyway, if you can&#8217;t use Linux or Mac I think you can a good anti virus software like <a
href="https://www.kaspersky.com/" target="_blank">Kaspersky</a></p><p>They are simple but strong to help you in any risk situation. Hope it help!</p><p>Welcome any comment.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/security-tips-for-wordpress/">Security tips for WordPress</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Randomise elements in PHP array with shuffle</title><link>https://wp2x.com/randomise-elements-in-php-array-with-shuffle/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Fri, 29 May 2015 15:14:41 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wordpress development]]></category> <category><![CDATA[wordpress ebook]]></category> <category><![CDATA[wordpress html]]></category> <category><![CDATA[wordpress programming]]></category> <category><![CDATA[wordpress theme]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=370</guid><description><![CDATA[<p>Randomise elements in PHP array with shuffle is quite easy. I have to spend at least an hour to optimise this task until I found shuffle function what already done this task :). The function reference you can check more detail here: http://php.net/manual/en/function.shuffle.php Here is an example for how to randomise elements in PHP array with ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/randomise-elements-in-php-array-with-shuffle/">Randomise elements in PHP array with shuffle</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Randomise elements in PHP array with shuffle is quite easy. I have to spend at least an hour to optimise this task until I found shuffle function what already done this task :).<span
id="more-370"></span></p><p>The function reference you can check more detail here: <a
href="http://php.net/manual/en/function.shuffle.php" target="_blank">http://php.net/manual/en/function.shuffle.php</a></p><p><a
href="http://wp2x.com/wp-content/uploads/2015/05/PHP__shuffle_-_Manual.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-371" src="http://wp2x.com/wp-content/uploads/2015/05/PHP__shuffle_-_Manual.jpg?4b2a2c&amp;4b2a2c" alt="PHP__shuffle_-_Manual" width="564" height="326" srcset="https://wp2x.com/wp-content/uploads/2015/05/PHP__shuffle_-_Manual.jpg 564w, https://wp2x.com/wp-content/uploads/2015/05/PHP__shuffle_-_Manual-300x173.jpg 300w" sizes="(max-width: 564px) 100vw, 564px" /></a></p><p>Here is an example for how to randomise elements in PHP array with <strong>shuffle</strong></p><p>Let &#8216;s run this code</p><pre class="lang:php decode:true ">&lt;?php
    $natural_born_killers = array("lions", "tigers", "bears", "kittens");
    shuffle($natural_born_killers);
    var_dump($natural_born_killers);
?&gt;</pre><p>Run in many times and try to see the result array, it will show you different result every time you run it.<br
/> One major drawback to using shuffle() is that it mangles your array keys. This is unavoidable sadly, and you need to live with it when you use shuffle(). Note that shuffle uses its parameter by reference &#8211; it returns true, but shuffles up the parameter you pass to it.</p><p>If you want to pick out just one random value from an array, you can use array_rand() &#8211; it takes an array to read from, then returns one random key from inside there. The advantage to array_rand() is that it leaves the original array intact &#8211; you can use the random key returned to grab the related value from the array, but other than that the original array is left untouched.</p><p><strong>Array_rand</strong>() has an optional second parameter that allows you to specify the number of elements you would like returned. These are each chosen randomly from the array, and are not necessarily returned in any particular order.</p><p>Before I show you an example, you need to be aware of the following attributes of <strong>array_rand</strong>():</p><p>It returns the keys in your array. If these aren&#8217;t specified, the default integer indexes are used. To get the value out of the array, just look up the value at the key.</p><p>If you ask for one random element, or do not specify parameter two, you will get a standard variable back.</p><p>If you ask for more than one random element, you will receive an array of variables back.</p><p>If you ask for more random elements than there are in the array you will get an error</p><p><strong>Array_rand</strong>() will not return duplicate elements if you request more than one random element</p><p>If you want to read most or all of the elements from your array in a random order, use a mass-randomiser like shuffle() &#8211; it is faster.</p><p>With that in mind, here&#8217;s an example of array_rand() in action:</p><pre class="lang:php decode:true">&lt;?php
    $natural_born_killers = array("lions", "tigers", "bears", "kittens");
    var_dump(array_rand($natural_born_killers, 2));
?&gt;</pre><p>&nbsp;</p><p>The post <a
rel="nofollow" href="https://wp2x.com/randomise-elements-in-php-array-with-shuffle/">Randomise elements in PHP array with shuffle</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Free WordPress Plugin Development Ebook</title><link>https://wp2x.com/free-wordpress-plugin-development-ebook/</link> <comments>https://wp2x.com/free-wordpress-plugin-development-ebook/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 04 Jun 2014 09:55:59 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Ebook]]></category> <category><![CDATA[free wordpress ebook]]></category> <category><![CDATA[wordpress development]]></category> <category><![CDATA[wordpress ebook]]></category> <category><![CDATA[wordpress programming]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=211</guid><description><![CDATA[<p>WordPress Plugin Development ebook for beginner is always the first ebook what any wordpress programmer need to get started. Everything you need in the first step to start with wordpress will be solved very fast and easy in this ebook. Believe me, anyone can find a very useful information from this free wordpress ebook, even ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/free-wordpress-plugin-development-ebook/">Free WordPress Plugin Development Ebook</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p><strong>WordPress Plugin Development ebook</strong> for beginner is always the first ebook what any wordpress programmer need to get started. Everything you need in the first step to start with wordpress will be solved very fast and easy in this ebook. <span
id="more-211"></span>Believe me, anyone can find a very useful information from this <strong>free wordpress ebook</strong>, even though you are wordpress expert.</p><p><a
href="http://wp2x.com/wp-content/uploads/2014/06/Wordpress-Plugin-Development-Beginner-s-Guide-Free-Wordpress-Ebook.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter wp-image-212 size-medium" src="http://wp2x.com/wp-content/uploads/2014/06/Wordpress-Plugin-Development-Beginner-s-Guide-Free-Wordpress-Ebook-300x139.png?4b2a2c&amp;4b2a2c" alt="Wordpress Plugin Development - Beginner 's Guide - Free WordPress Ebook" width="300" height="139" srcset="https://wp2x.com/wp-content/uploads/2014/06/Wordpress-Plugin-Development-Beginner-s-Guide-Free-Wordpress-Ebook-300x139.png 300w, https://wp2x.com/wp-content/uploads/2014/06/Wordpress-Plugin-Development-Beginner-s-Guide-Free-Wordpress-Ebook.png 852w" sizes="(max-width: 300px) 100vw, 300px" /></a></p><p>&nbsp;</p><p>Now, we share you this useful ebook with all of topic it can cover what include:</p><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 1: Preparing for WordPress Development</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 2: Social Bookmarking</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 3: Live Blogroll</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 4: The Wall</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 5: Snazzy Archives</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 6: Insights for WordPress</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 7: Post Types</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> Chapter 8: Development Goodies</li></ul></div><p>As you see, you cover almost the popular problems what a wordpress developer need to do their job. If you finish this ebook research you can get started with any wordpress plugin project and make money as you want :).</p><p>You can download the ebook in the form below:<div
class="freebie-sub-box"><div
class="freebie-sub-inner"><h3>Please enter your email and get it now!</h3><p>Simply enter your email address and the download link will be sent right to your email box.</p><form
class="freebie-sub-form"><div
class="replaceArea"><div
class="replaceArea-error"></div><center> <input
type="text" onblur="if(this.value=='')this.value='Email Address';" onfocus="if(this.value=='Email Address')this.value='';" value="Email Address" name="email" class="name"> <input
type="submit" value="Download" class="freebie-submit"></center> <input
type="hidden" name="id" id="id" value="aHR0cHM6Ly9hcHAuYm94LmNvbS9zL3NicWhlZGRlbTBwbm13am5kemZv"></div></form></div></div><p>Good luck!</p><p>The post <a
rel="nofollow" href="https://wp2x.com/free-wordpress-plugin-development-ebook/">Free WordPress Plugin Development Ebook</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/free-wordpress-plugin-development-ebook/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Create a Simple WordPress Plugin Tutorial</title><link>https://wp2x.com/create-simple-wordpress-plugin-tutorial/</link> <comments>https://wp2x.com/create-simple-wordpress-plugin-tutorial/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 10 Apr 2014 22:19:23 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Featured]]></category> <category><![CDATA[Wordpress Plugins]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[wordpress development]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress programming]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=138</guid><description><![CDATA[<p>WordPress Plugin &#8216;s quite easy with a lot of fun to get started with it. It just take you 5 minutes to create a simple wordpress plugin with the useful functionality. In this blog post, I will show you a very simple wordpress plugin tutorial with very first step to build a quality wordpress plugin. ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/create-simple-wordpress-plugin-tutorial/">Create a Simple WordPress Plugin Tutorial</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p><strong>WordPress Plugin</strong> &#8216;s quite easy with a lot of fun to get started with it. It just take you 5 minutes to create a <strong>simple wordpress plugin</strong> with the useful functionality. In this blog post, I will show you a very simple <strong>wordpress plugin tutorial</strong> with very first step to build a quality wordpress plugin. After this, you are free to extension unlimited your plugin.<span
id="more-138"></span></p><h2>WordPress Plugin Idea</h2><p>Before building any plugin, we should site down and write all of our requirements to save time and do the right way in coding time. In my simple wordpress plugin idea include:</p><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check" style="color:#40dd1b"></i> <strong>Name</strong>: WordPress Simple Shortcode</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> <strong>Description</strong>: implement a custom shortcode what only use for personal purpose</li><li><i
class="sui sui-check" style="color:#40dd1b"></i> <strong>Publication</strong>: for blog post tutorial on wp2x.com</li></ul></div><p>Now, let &#8216;s go with our first wordpress plugin</p><h2>WordPress Plugin Basic File Structure</h2><p>As the minimum requirements, wordpress plugin only need one php file in folder /wp-content/plugins/ but no one do thing like that since it &#8216;s very difficult to maintain. So even though we do a simple wordpress plugin, let &#8216;s learn for future to build a complex plugin. So, the basic wordpress plugin file structure include:</p><ul><li>A folder in /wp-content/plugins/: let &#8216;s create it is <strong>simple-shortcode</strong></li><li>A php file in plugin folder /wp-content/plugins/<strong>simple-shortcode</strong> with the same name as plugin folder, so it should be /wp-content/plugins/<strong>simple-shortcode/simple-shortcode.php</strong></li></ul><div
id="attachment_140" style="width: 262px" class="wp-caption aligncenter"><img
aria-describedby="caption-attachment-140" loading="lazy" class="size-full wp-image-140" src="http://wp2x.com/wp-content/uploads/2014/04/wordpress-plugin-file-structure.png?4b2a2c&amp;4b2a2c" alt="wordpress plugin file structure" width="252" height="92" /><p
id="caption-attachment-140" class="wp-caption-text">wordpress plugin file structure</p></div><h2>WordPress Plugin Header</h2><p>Somehow WordPress need to know the basic information of your wordpress plugin to display in control panel, kind of detail of a plugin. And here is all that needs to be in your plugin file for WordPress to recognize it once uploaded. Let &#8216;s add it as first line in file <strong>simple-shortcode.php</strong><br
/></p><pre class="lang:php decode:true ">&lt;?php
/*
Plugin Name: My Custom Functions
*/</pre><p>See how easy that is? At this point you have a plugin that you can activate in your WordPress plugins area. Of course our plugin doesn’t actually do anything yet but the point is you have laid the foundation of your very own plugin and it was super easy.</p><p>Now there are other elements that you can include in this header. Things like a description, version, author, etc. You can read more about those here: <a
href="http://codex.wordpress.org /Writing_a_Plugin #File_Headers" target="_blank">http://codex.wordpress.org /Writing_a_Plugin #File_Headers</a></p><p>That &#8216;s all to get a new wordpress plugin, let visit your wordpress plugin admin and activate it. Time to build the main function</p><h2>Capture wordpress hooks</h2><p>Keep in mind that to get our plugin optimize, we only execute our action code via wordpress shortcode except some special case. For the most case, we will capture the <strong>init</strong> hook of wordpress. Here is the code.</p><pre class="lang:php decode:true ">add_action( 'init', 'simple_shortcode_register_shortcodes');</pre><p>See, we call function <strong>simple_shortcode_register_shortcodes</strong> when the wordpress system init and we need to define this function.</p><pre class="lang:php decode:true ">function simple_shortcode_register_shortcodes()
{
add_shortcode('my-first-shortcode', 'simple_shortcode_my_first_shortcode');
}</pre><p>Again we add a shortcode with tag <strong>my-first-shortcode</strong> and defined by function <strong>simple_shortcode_my_first_shortcode.</strong> One more time we need to define this function:</p><pre class="lang:php decode:true ">function simple_shortcode_my_first_shortcode($atts, $content){
extract(shortcode_atts(array(
'lastname' =&gt; ''
), $atts));
return "&lt;strong&gt;{$content} {$lastname}";
}</pre><p>&nbsp;</p><p>Ok, it &#8216;s quite simple, for more detail how to define this function you can look at wordpress API <a
href="https://codex.wordpress.org/Function_Reference/add_shortcode" target="_blank">https://codex.wordpress.org/Function_Reference/add_shortcode</a> . And I guess, you will know where to search for WordPress API :-).</p><p>The next step, let &#8216;s test it. Create a new post with this detail:</p> [code]Hello [my-first-shortcode lastname=&#8221;Pham&#8221;]David[/my-first-shortcode][/code]<p>Now, view it on front-end to see the magic.</p><p>And here is the bonus for you if you need more advance about wordpress plugin <a
href="https://codex.wordpress.org/Writing_a_Plugin" target="_blank">https://codex.wordpress.org/Writing_a_Plugin</a></p><p>The post <a
rel="nofollow" href="https://wp2x.com/create-simple-wordpress-plugin-tutorial/">Create a Simple WordPress Plugin Tutorial</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/create-simple-wordpress-plugin-tutorial/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> </channel> </rss>