notes

Check if Multi Content Block is Empty

Using Multiple Content Blocks by Trendwerks. Check if block has content and if not do something else such as default content: if (has_block(‘cta 3’)) { the_block(‘cta 3’); } else { // do something here echo do_shortcode(“[contentblock id=3] “); }  

Read More

Specifying IP range using slash notation (CIDR Notation)

This is useful when specifying a range of IP addresses to block for instance. Full details here: http://networkengineering.stackexchange.com/questions/3697/the-slash-after-an-ip-address-cidr-notation Quick and nasty explanation: The number after the slash specifies the subnet mask to use which in turn limits the wild card numbers in the IP address IP Address Subnet Mask IP Range 192.168.10.0/24 255.255.255.0 192.168.10.* 192.168.10.0/16…

Read More

htaccess Redirect and Remove Query String

To redirect menu.php?diet=vegan to /new-page-name whilst loosing the query string use this redirect in the .htaccess file RewriteRule ^menu\.php$ /new-page-name? [L,R=301]  The trailing ? removes the query string

Read More

Running WordPress with Tilde (~) in Site URL

For example to run WordPress on a URL such as:http://www.babelscribe.com/~mysite/ Change siteurl and blogname in the options table to the above url. Change default htaccess redirects to: RewriteEngine On RewriteBase /~mysite/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /~mysite/index.php [L] This is useful if you need to access an account…

Read More