notes
WordPress Load Sidebar Based on Parent Page and Child Pages
This will load a particular sidebar based on the page id and will load the same sidebar on all child pages of which the main page is the parent. Use this in the sidebar page: 1) Detect if page has a parent page and if so get the parent page id: <?php //get parent id…
Read MoreCheck 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 MoreSpecifying 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 Morehtaccess 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 MoreDisable all Plugins in the WordPress Database
Run this query on the wp-options table to disable all plugins: UPDATE wp_options SET option_value = ” WHERE option_name = ‘active_plugins’;
Read MoreRunning 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