<?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 tutorial - WP2X</title> <atom:link href="https://wp2x.com/tag/wordpress-tutorial/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>Install Redis Caching to Speed Up WordPress on Ubuntu</title><link>https://wp2x.com/install-redis-caching-to-speed-up-wordpress-on-ubuntu/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Mon, 28 Sep 2015 10:03:46 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[cache]]></category> <category><![CDATA[redis]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=417</guid><description><![CDATA[<p>In this tutorial, Redis will be configured as a cache for WordPress to alleviate the redundant and time-consuming database queries used to render a WordPress page. The result is a WordPress site which is much faster, uses less database resources, and provides a tunable persistent cache. Redis is an open-source key value store that can ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/install-redis-caching-to-speed-up-wordpress-on-ubuntu/">Install Redis Caching to Speed Up WordPress on Ubuntu</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>In this tutorial, Redis will be configured as a cache for WordPress to alleviate the redundant and time-consuming database queries used to render a WordPress page. The result is a WordPress site which is much faster, uses less database resources, and provides a tunable persistent cache.<span
id="more-417"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2015/09/redis_cashing_for_wordpress.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-418" src="http://wp2x.com/wp-content/uploads/2015/09/redis_cashing_for_wordpress.png?4b2a2c&amp;4b2a2c" alt="redis_cashing_for_wordpress" width="547" height="338" srcset="https://wp2x.com/wp-content/uploads/2015/09/redis_cashing_for_wordpress.png 547w, https://wp2x.com/wp-content/uploads/2015/09/redis_cashing_for_wordpress-300x185.png 300w" sizes="(max-width: 547px) 100vw, 547px" /></a></p><p>Redis is an open-source key value store that can operate as both an in-memory store and as cache. Redis is a data structure server that can be used as a database server on its own, or paired with a relational database like MySQL to speed things up, as we&#8217;re doing in this tutorial.</p><p>Default WordPress home page without Redis:</p><p>804ms page load time</p><p>Default WordPress home page with Redis:</p><p>449ms page load time</p><h2>Redis vs. Memcached</h2><p>Memcached is also a popular cache choice. However, at this point, Redis does everything Memcached can do, with a much larger feature set. This Stack Overflow page has some general information as an overview or introduction to persons new to Redis.</p><h2>Step 1 — Install Redis</h2><p>In order to use Redis with WordPress, two packages need to be installed: redis-server and php5-redis. The redis-server package provides Redis itself, while the php5-redis package provides a PHP extension for PHP applications like WordPress to communicate with Redis.</p><p>Install the softare:</p><pre class="lang:default decode:true">sudo apt-get install redis-server php5-redis</pre><h2>Step 2 — Configure Redis as a Cache</h2><p>Redis can operate both as a NoSQL database store as well as a cache. For this guide and use case, Redis will be configured as a cache. In order to do this, the following settings are required.</p><p>Edit the file /etc/redis/redis.conf and add the following lines at the bottom:</p><p>Add these lines at the end of the file:</p><pre class="lang:default decode:true ">maxmemory 256mb
maxmemory-policy allkeys-lru</pre><p>When changes are complete, save and close the file.</p><h2>Step 3 — Obtain Redis Cache Backend Script</h2><p>This PHP script for WordPress was originally developed by Eric Mann. It is a Redis object cache backend for WordPress.</p><p>Download the object-cache.php script. This download is from DigitalOcean&#8217;s asset server, but this is a third-party script. You should read the comments in the script to see how it works.</p><p>Download the PHP script:</p><pre class="lang:default decode:true">wget https://assets.digitalocean.com/articles/wordpress_redis/object-cache.php</pre><p>Move the file to the /wp-content directory of your WordPress installation:</p><pre class="lang:default decode:true ">sudo mv object-cache.php /var/www/html/wp-content/</pre><p>Depending on your WordPress installation, your location may be different.</p><h2>Step 4 — Enable Cache Settings in wp-config.php</h2><p>Next, edit the wp-config.php file to add a cache key salt with the name of your site (or any string you would like).</p><pre class="lang:default decode:true ">nano /var/www/html/wp-config.php</pre><p>Add this line at the end of the * Authentication Unique Keys and Salts. section:</p><pre class="lang:default decode:true ">define('WP_CACHE_KEY_SALT', 'example.com');</pre><p>You can use your domain name or another string as the salt.</p><p><strong>Note</strong>: For users hosting more than one WordPress site, each site can share the same Redis installation as long as it has its own unique cache key salt.</p><p>Also, add the following line after the WP_CACHE_KEY_SALT line to create a persistent cache with the Redis object cache plugin:</p><pre class="lang:default decode:true">define('WP_CACHE', true);</pre><p>All together, your file should look like this:</p><p>* Authentication Unique Keys and Salts.</p><pre class="lang:default decode:true ">. . .

define('NONCE_SALT', 'put your unique phrase here');

define('WP_CACHE_KEY_SALT', 'example.com');
define('WP_CACHE', true);
Save and close the file.
</pre><h2>Step 5 — Restart Redis and Apache</h2><p>Finally, restart redis-service and apache2.</p><p>Restart Redis:</p><pre class="lang:default decode:true ">sudo service redis-server restart</pre><p>Restart Apache:</p><pre class="lang:default decode:true ">sudo service apache2 restart</pre><p>Restart php5-fpm if you are using it; this is not part of the basic installation on DigitalOcean:</p><pre class="lang:default decode:true ">sudo service php5-fpm restart</pre><p>That&#8217;s it! Your WordPress site is now using Redis caching. If you check your page load speeds and resource use, you should notice improvements.</p><p>Monitor Redis with redis-cli</p><p>To monitor Redis, use the redis-cli command like so:</p><pre class="lang:default decode:true ">redis-cli monitor</pre><p>When you run this command, you will see the real-time output of Redis serving cached queries. If you don&#8217;t see anything, visit your website and reload a page.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/install-redis-caching-to-speed-up-wordpress-on-ubuntu/">Install Redis Caching to Speed Up WordPress on Ubuntu</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>WordPress Hosting/Server System Requirements</title><link>https://wp2x.com/wordpress-hostingserver-system-requirements/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Thu, 30 Jul 2015 11:14:42 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[Wordpress Hosting]]></category> <category><![CDATA[best wordpress hosting]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[php web hosting]]></category> <category><![CDATA[top wordpress hosting]]></category> <category><![CDATA[web hosting]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=402</guid><description><![CDATA[<p>WordPress require a very small server configuration hardware and software. In this post, I only talk about the wordpress system requirements what enough to run wordpress (not wordpress fully optimized hosting what make wordpress work fast). Here is simple requirements When you use WordPress with system requirements, you can check these plugins for help</p><p>The post <a
rel="nofollow" href="https://wp2x.com/wordpress-hostingserver-system-requirements/">WordPress Hosting/Server System Requirements</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>WordPress require a very small server configuration hardware and software. In this post, I only talk about the wordpress system requirements what enough to run wordpress (not wordpress fully optimized hosting what make wordpress work fast).<span
id="more-402"></span></p><p><img
loading="lazy" class="aligncenter size-full wp-image-403" src="http://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements.jpg?4b2a2c&amp;4b2a2c" alt="Wordpress-Hosting-System-Requirements" width="606" height="306" srcset="https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements.jpg 606w, https://wp2x.com/wp-content/uploads/2015/07/Wordpress-Hosting-System-Requirements-300x151.jpg 300w" sizes="(max-width: 606px) 100vw, 606px" /></p><p>Here is simple requirements<br
/><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> wOS: Linux/Unix/Mac/Windows</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> Web server: Apache/Nginx (or any web server support PHP well)</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> PHP 5.2.4 or greater</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> MySQL 5.0 or greater</li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> The mod_rewrite Apache module</li></ul></div> When you use WordPress with system requirements, you can check these plugins for help<br
/><div
class="su-list" style="margin-left:0px"><ul><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> Library for handling minimum system requirements in WordPress Plugins:<a
href="https://github.com/dsawardekar/wp-requirements" target="_blank">https://github.com/dsawardekar/wp-requirements</a></li><li><i
class="sui sui-check-square-o" style="color:#2fd730"></i> System Requirements Check:<a
href="https://wordpress.org/plugins/system-requirements-check/" target="_blank">https://wordpress.org/plugins/system-requirements-check/</a></li></ul></div><p>The post <a
rel="nofollow" href="https://wp2x.com/wordpress-hostingserver-system-requirements/">WordPress Hosting/Server System Requirements</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </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>Top 3 Image Optimize WordPress Plugin for SEO</title><link>https://wp2x.com/top-3-image-optimize-wordpress-plugin-for-seo/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 24 Jun 2015 04:55:26 +0000</pubDate> <category><![CDATA[Wordpress Plugins]]></category> <category><![CDATA[image]]></category> <category><![CDATA[optimize]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=383</guid><description><![CDATA[<p>Image optimize in wordpress is quite simple to solve what give us a lot of score in Google Speed insight check. If you check score with Google Insight you will see something like this. &#160; In this tutorial we will show you 3 wordpress plugins what can help you reduce the image size but still ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/top-3-image-optimize-wordpress-plugin-for-seo/">Top 3 Image Optimize WordPress Plugin for SEO</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Image optimize in wordpress is quite simple to solve what give us a lot of score in Google Speed insight check. If you check score with Google Insight you will see something like this.<span
id="more-383"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2015/06/PageSpeed_Insights.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-384" src="http://wp2x.com/wp-content/uploads/2015/06/PageSpeed_Insights.jpg?4b2a2c&amp;4b2a2c" alt="PageSpeed_Insights" width="540" height="177" srcset="https://wp2x.com/wp-content/uploads/2015/06/PageSpeed_Insights.jpg 540w, https://wp2x.com/wp-content/uploads/2015/06/PageSpeed_Insights-300x98.jpg 300w" sizes="(max-width: 540px) 100vw, 540px" /></a></p><p>&nbsp;</p><p>In this tutorial we will show you 3 wordpress plugins what can help you reduce the image size but still keep a very good image quality. It will help to speed up the image load and page load.</p><h2>1. EWWW Image Optimizer</h2><p>Download: <a
href="https://wordpress.org/plugins/ewww-image-optimizer/" target="_blank">https://wordpress.org/plugins/ewww-image-optimizer/</a></p><p>This is my No. 1 suggestion since it &#8216;s very easy to use and save time. Even though you got a lot of old images what need to reduce size, it still help you solve that with Bulk feature. Check this screen</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/06/Bulk_Optimize.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-385" src="http://wp2x.com/wp-content/uploads/2015/06/Bulk_Optimize.jpg?4b2a2c&amp;4b2a2c" alt="Bulk_Optimize" width="549" height="325" srcset="https://wp2x.com/wp-content/uploads/2015/06/Bulk_Optimize.jpg 549w, https://wp2x.com/wp-content/uploads/2015/06/Bulk_Optimize-300x178.jpg 300w" sizes="(max-width: 549px) 100vw, 549px" /></a></p><p>&nbsp;</p><p>The EWWW Image Optimizer is a WordPress plugin that will automatically optimize your images as you upload them to your blog. It can optimize the images that you have already uploaded, convert your images automatically to the file format that will produce the smallest image size (make sure you read the WARNINGS), and optionally apply lossy reductions for PNG and JPG images.</p><h2>2. WP Smush</h2><p>Download: <a
href="https://wordpress.org/plugins/wp-smushit/" target="_blank">https://wordpress.org/plugins/wp-smushit/</a></p><p>WP Smush strips hidden, bulky information from your images, reducing the file size without losing quality. The faster your site loads, the more Google, Bing, Yahoo and other search engines will like it.</p><p>Look at this video and you will how it do</p><p><iframe
width="560" height="315" src="https://www.youtube.com/embed/GCzH7z05s5U?feature=oembed" frameborder="0" allowfullscreen></iframe></p><h2>3. Kraken Image Optimizer</h2><p>Download: <a
href="https://kraken.io/?ref=d48f2eb26e3a" target="_blank">https://wordpress.org/plugins/kraken-image-optimizer/</a></p><p>This plugin allows you to optimize your WordPress images through the Kraken API, the world&#8217;s most advanced image optimization solution.</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/06/Kraken_Image_Optimizer.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-386" src="http://wp2x.com/wp-content/uploads/2015/06/Kraken_Image_Optimizer.jpg?4b2a2c&amp;4b2a2c" alt="Kraken_Image_Optimizer" width="464" height="248" srcset="https://wp2x.com/wp-content/uploads/2015/06/Kraken_Image_Optimizer.jpg 464w, https://wp2x.com/wp-content/uploads/2015/06/Kraken_Image_Optimizer-300x160.jpg 300w" sizes="(max-width: 464px) 100vw, 464px" /></a></p><p>This plugin allows you to optimize new and existing WordPress image uploads through Kraken Image Optimizer&#8217;s API. Both lossless and intelligent lossy optimization modes are supported. Supported filetypes are JPEG, PNG and GIF. Maximum filesize limit is 16 MB.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/top-3-image-optimize-wordpress-plugin-for-seo/">Top 3 Image Optimize WordPress Plugin for SEO</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>Convert a string to a number in PHP</title><link>https://wp2x.com/convert-string-number-php/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Sat, 16 May 2015 05:41:16 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[convert]]></category> <category><![CDATA[number]]></category> <category><![CDATA[wordpress]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=365</guid><description><![CDATA[<p>Convert a string to a number in PHP is quite simple, let me show you the problem and the solution for it. &#160; Here is what we need to do Input Output '2' 2 '2.34' 2.34 '0.3454545' 0.3454545 Now, let &#8216;s do the magic $num = "3.14"; $int = (int)$num; $float = (float)$num; For more ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/convert-string-number-php/">Convert a string to a number in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Convert a string to a number in PHP is quite simple, let me show you the problem and the solution for it.<span
id="more-365"></span></p><p>&nbsp;</p><p><a
href="http://wp2x.com/wp-content/uploads/2015/05/number.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-366" src="http://wp2x.com/wp-content/uploads/2015/05/number.png?4b2a2c&amp;4b2a2c" alt="number" width="290" height="238" /></a></p><p>Here is what we need to do</p><pre class="lang:sh decode:true ">Input             Output
'2'               2
'2.34'            2.34
'0.3454545'       0.3454545</pre><p>Now, let &#8216;s do the magic</p><pre class="lang:default decode:true ">$num = "3.14";
$int = (int)$num;
$float = (float)$num;</pre><p>For more detail you can do like this</p><p>1. Cast the strings to numeric primitive data types:</p><pre class="lang:php decode:true ">$num = (int) "10";
$num = (double) "10.12"; // same as (float) "10.12";</pre><p>2. Perform math operations on the strings:</p><pre class="lang:php decode:true ">$num = "10" + 1;
$num = floor("10.1");</pre><p>3. Use intval() or floatval():</p><pre class="lang:php decode:true ">$num = intval("10");
$num = floatval("10.1");</pre><p>I think they are good enough for you to convert string to any number type.</p><p>The post <a
rel="nofollow" href="https://wp2x.com/convert-string-number-php/">Convert a string to a number in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Get last character from string in PHP</title><link>https://wp2x.com/get-last-character-from-string-in-php/</link> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Sun, 19 Apr 2015 12:53:56 +0000</pubDate> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[php programming]]></category> <category><![CDATA[php string]]></category> <category><![CDATA[php tips]]></category> <category><![CDATA[php wordpress]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=361</guid><description><![CDATA[<p>Easy but not for all of us to get last character from string in PHP. It &#8216;s quite simple to figure out with a quick Google it. So if you found my article about this. Then you are in right place to solve this issuse with a simplest way. 1. Get the last char of a ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/get-last-character-from-string-in-php/">Get last character from string in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Easy but not for all of us to get last character from string in PHP. It &#8216;s quite simple to figure out with a quick Google it. So if you found my article about this. Then you are in right place to solve this issuse with a simplest way.<span
id="more-361"></span></p><h2><a
href="http://wp2x.com/wp-content/uploads/2015/04/php-string.jpeg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-362" src="http://wp2x.com/wp-content/uploads/2015/04/php-string.jpeg?4b2a2c&amp;4b2a2c" alt="php string" width="259" height="194" /></a></h2><h2>1. Get the last char of a string in PHP</h2><p>If you want to get the only one character in a string, here is simplest function to do.</p><pre class="lang:php decode:true">substr("testers", -1); // returns "s"</pre><p>So simple?</p><p>And what if you want 2 characters? Let &#8216;s do this</p><pre class="lang:default decode:true ">substr("testers", -2); // returns "rs"</pre><h2> 2. Remove the last character from string</h2><p>Just a bonus if this article, if you want to remove the last character in a string. You can do this function</p><pre class="lang:php decode:true ">substr("a,b,c,d,e,", 0, -1);</pre><p>The output is a,b,c,d,e</p><p>Hope this article help you solve the problem with string.</p><p>Thanks</p><p>The post <a
rel="nofollow" href="https://wp2x.com/get-last-character-from-string-in-php/">Get last character from string in PHP</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> </item> <item><title>Crayon Syntax Highlighter WordPress plugin</title><link>https://wp2x.com/crayon-syntax-highlighter-wordpress-plugin/</link> <comments>https://wp2x.com/crayon-syntax-highlighter-wordpress-plugin/#comments</comments> <dc:creator><![CDATA[david]]></dc:creator> <pubDate>Wed, 05 Nov 2014 11:14:22 +0000</pubDate> <category><![CDATA[Blog]]></category> <category><![CDATA[HTML/JavaScript/CSS]]></category> <category><![CDATA[Wordpress Plugins]]></category> <category><![CDATA[Wordpress Tips]]></category> <category><![CDATA[free wordpress plugin]]></category> <category><![CDATA[wordpress highlight]]></category> <category><![CDATA[wordpress plugin]]></category> <category><![CDATA[wordpress tips]]></category> <category><![CDATA[wordpress tutorial]]></category> <guid
isPermaLink="false">http://wp2x.com/?p=315</guid><description><![CDATA[<p>Crayon Syntax Highlighter is a perfect highlight code solution for any wordpress site. It &#8216;s fast, simple and easy to use. Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text. First of all, you can download and install here: https://wordpress.org/plugins/crayon-syntax-highlighter/ A Syntax Highlighter built in PHP and jQuery that supports ...</p><p>The post <a
rel="nofollow" href="https://wp2x.com/crayon-syntax-highlighter-wordpress-plugin/">Crayon Syntax Highlighter WordPress plugin</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></description> <content:encoded><![CDATA[<p>Crayon Syntax Highlighter is a perfect highlight code solution for any wordpress site. It &#8216;s fast, simple and easy to use. Syntax Highlighter supporting multiple languages, themes, fonts, highlighting from a URL, local file or post text.<span
id="more-315"></span></p><p><a
href="http://wp2x.com/wp-content/uploads/2014/11/banner-772x250.jpg?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-316" src="http://wp2x.com/wp-content/uploads/2014/11/banner-772x250.jpg?4b2a2c&amp;4b2a2c" alt="banner-772x250" width="772" height="248" srcset="https://wp2x.com/wp-content/uploads/2014/11/banner-772x250.jpg 772w, https://wp2x.com/wp-content/uploads/2014/11/banner-772x250-300x96.jpg 300w" sizes="(max-width: 772px) 100vw, 772px" /></a></p><p>First of all, you can download and install here: <a
href="https://wordpress.org/plugins/crayon-syntax-highlighter/" target="_blank">https://wordpress.org/plugins/crayon-syntax-highlighter/</a></p><p>A Syntax Highlighter built in PHP and jQuery that supports customizable languages and themes. It can highlight from a URL, a local file or WordPress post text. Crayon makes it easy to manage Language files and define custom language elements with regular expressions. It also supports some neat features like:</p><ul><li>Integrated Theme Editor!</li><li>Tag Editor in both Visual &amp; HTML editors</li><li>Toggled plain code</li><li>Toggled line numbers</li><li>Copy/paste code</li><li>Open code in a new window (popup)</li><li>Line wrapping</li><li>Code expanding</li><li>Minimizing</li><li>bbPress 2 support</li><li>Converting legacy code in blog posts/comments to &lt;pre&gt;</li><li>Remote request caching</li><li>Mixed Language Highlighting in a single Crayon</li><li>Mini Tags like [php][/php]</li><li>Inline Tags floating in sentences</li><li>Crayons in comments</li><li>`Backquotes` become code</li><li>pre tag support, option to use setting-value in the class attribute</li><li>Valid HTML 5 markup</li><li>Visual &amp; HTML editor compatible</li><li>Mobile/touchscreen device detection</li><li>Mouse event interaction (showing plain code on double click, toolbar on mouseover)</li><li>Tab sizes</li><li>Code title</li><li>Toggled toolbar</li><li>Retina buttons</li><li>Striped lines</li><li>Line marking (for important lines)</li><li>Line ranges (showing only parts of the code)</li><li>Starting line number (default is 1)</li><li>Local directory to search for local files</li><li>File extension detection</li><li>Live Preview in settings</li><li>Dimensions, margins, alignment, font-size, line-height, float</li><li>Extensive error logging</li></ul><p>The code highlight is very easy to use in back end with the toobar icon and window</p><p><a
href="http://wp2x.com/wp-content/uploads/2014/11/icon-tools-bar.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-318" src="http://wp2x.com/wp-content/uploads/2014/11/icon-tools-bar.png?4b2a2c&amp;4b2a2c" alt="icon-tools bar" width="350" height="193" srcset="https://wp2x.com/wp-content/uploads/2014/11/icon-tools-bar.png 350w, https://wp2x.com/wp-content/uploads/2014/11/icon-tools-bar-300x165.png 300w" sizes="(max-width: 350px) 100vw, 350px" /></a></p><p>And the highlight code will be display in front end like this</p><p><a
href="http://wp2x.com/wp-content/uploads/2014/11/screenshot-3.png?4b2a2c&amp;4b2a2c"><img
loading="lazy" class="aligncenter size-full wp-image-317" src="http://wp2x.com/wp-content/uploads/2014/11/screenshot-3.png?4b2a2c&amp;4b2a2c" alt="screenshot-3" width="652" height="737" srcset="https://wp2x.com/wp-content/uploads/2014/11/screenshot-3.png 652w, https://wp2x.com/wp-content/uploads/2014/11/screenshot-3-265x300.png 265w" sizes="(max-width: 652px) 100vw, 652px" /></a></p><p>The post <a
rel="nofollow" href="https://wp2x.com/crayon-syntax-highlighter-wordpress-plugin/">Crayon Syntax Highlighter WordPress plugin</a> appeared first on <a
rel="nofollow" href="https://wp2x.com">WP2X</a>.</p> ]]></content:encoded> <wfw:commentRss>https://wp2x.com/crayon-syntax-highlighter-wordpress-plugin/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>