WordPress Frequently Asked Questions
Child Themes are “extensions” of an already existing WordPress template. In object terms, Creating a child theme, allows you to edit or add functionality to your template without having to overwrite any of the parent theme files, risking making mistakes or losing your job when you make updates. Otherwise, if you make changes directly to the Theme, the next Theme update will wipe out all of your changes. I like to use the Child Theme Generator plug-in to accomplish this. It allows you to create multiple children, although just one is generally enough. To create a child theme, follow these steps: There are two ways to force external links to open in a new tab or window: The “Open in New Window” checkbox in “Open link in a new tab” (the chain link in the editor), does not always work. Therefore in order to sure that the link appears in a new window or tab, you must code the link in the following JavaScript. <a onclick=”window.open (‘YourLinkURL‘, ‘_blank’);” href=”javascript:void(0);”>Text for MyLink</a> There is a very nice WordPress plug-in “Open in New Window Plugin“. Any link that is not pointed to your website, will automatically open in a new tab or window. And that is all there is to it. After doing an extensive review, I really like, use and recommend UpdraftPlus Backup/Restore. It schedules itself to run automatically, it does a complete backup of your database, themes, plug-ins, media, etc. UpdarftPlus will also move your backups to remote cloud storage such as DropBox, Google Drive, an FTP server of your choice, multiple storage sites, etc. It also will clean up after itself by deleting old backups beyond the limit you set. You can do all of the above with the free version. Restores are very simple to perform and UpdraftPlus checks thoroughly before the restore is done. With the addition of either the UNIX sed command or better, the Better Search and Replace plug-in. Recently, I ran into a template related issue. It took over control of <h1> and <h2>. Essentially the home page was suppressed. SEO will penalize you for having more than 1 <h1>, but you can have several <h2>s. Using the HTML Widget, I managed to insert them into the homepage. The result works very well, inspect my site’s home page, and see if you can find them. For all practical purposes, you can never just use one SEO tool. On the WordPress side of the equation, I use either RankMath or All-in-One-SEO plugins to gather the SEO information and to generate my sitemap.xml. From a usage perspective, Personally I like using RankMath as it immediate feedback inside the editing process helps tune your site with “on-the-spot” visual feedback. Also, it is relatively new, thus it avoids carrying all the baggage of old SEO tools. All-in-One-SEO pack does an excellent job and is quite comprehensive and well supported. It, however, lacks the visual feedback features of RabkMath. From an analysis standpoint, RankMath SEO Analyzer does a nice job of ranking your website and also has a good diagnostics report that you can use to follow up on SEO issues. Another good analysis product is SiteChecker Pro. SiteChecker Pro free version will generate a very thorough report about SEO issues to be addressed. A great tool for watching how your webpages are working and for diagnosing tricky SEO problems is Screaming Frog Spider. It is invaluable in tracking down bad links, redirects, and HTTP errors. I received a recommendation recently about a great set of tools from WebsitePlanet.com . Gracias Diana Gonzales-Ester por su recomendación. Their collection of free tools is impressive and handy. Of note are: Redirect Tracking (to make sure things are going where you think they are), XML Sitemap Checker (validates your sitemaps), Robots.txt Tester (validates your robots.txt), Responsive Design Check which I really liked, as it will render your site on several different cell phones, tablets, and laptops eg. iPhone X, 8, iPad, Samsung Galaxy S7, ASUS Nexus 7, Kindle Fire, etc. SSL Checker does a good job verifying your certificate and its proper installation. And much more. Give it a try, it is a great selection of tools. This can be caused by a number of things, however, if you use more than one “environment” under your registered website name, this solution should fix this for you. Also, if you have recently switched from Plain PermaLinks to %postname% PermaLinks or others, you may run into this problem as well. By “environments”, I mean things like test, devl, next (stage), prod, etc. These are normally called sub-domains. They could also be different language translations. EG. en, fr, es, ru, etc. Regardless, the situation results in too many redirects as WordPress does not automatically redirect to index.php when the URL ends with a directory name with or without a trailing /, resulting in an infinite loop. For example: If you have registered MySite.com, the internet will direct your request to where your main site is located. EG. https://MySite.com. You may have two environments, stage and prod, which is quite common and strongly recommended. Stage is where you make your changes and test them, prod is your environment that the world sees. <?php You can access the other directories using the URL request. EG. https://MySite.com/stage. Generally, this will partially work if you include a page name. EG. https://MySite.com/stage/about_us, however, the directives that WordPress inserts by default, break when no page name is specified. EG. https://MySite.com/stage or https://MySite/stage/ and https://MySite.com/prod or https://MySite.com/prod and since you have the redirect in the home directory, https://MySite.com or https://MySite.com/. # BEGIN Aldersoft Permalink fix and also the following needs to be added to the beginning of your .htaccess in public_html/prod. # BEGIN Aldersoft Permalink fix This essentially says: Note. Thank you Jacob Buller of EcoVillages.CA for your help in debugging this. What is a Child Theme ?
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {
$parent_style = ‘parent-style’;
wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’,
array( $parent_style ), wp_get_theme()-&gt;get(‘Version’);
}
?>
/*This file is part of twenty-twenty-child, twenty-twenty base child theme.
All functions of this file will be loaded before of parent theme functions.
Learn more at https://codex.wordpress.org/Child_Themes.
Note: this function loads the parent stylesheet before, then child theme stylesheet
(leave it in place unless you know what you are doing.)
*/function education_base_child_enqueue_child_styles() {
$parent_style = ‘parent-style’;
wp_enqueue_style($parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’,
array( $parent_style ),
wp_get_theme()->get(‘Version’) );
}
add_action( ‘wp_enqueue_scripts’, ‘education_base_child_enqueue_child_styles’ );
function disable_admin_bar() {
if (is_user_logged_in() && (! current_user_can(‘subscriber’))) {
show_admin_bar(true);
} else {
show_admin_bar(false);
}
}
endif;
add_action(‘init’, ‘disable_admin_bar’);How can I make external links open in a new tab or window ?
The hard way.
The Easy Way
What is a good WordPress backup ?
SEO tells you that you are missing an H1 or H2, but your theme won’t let you ?
<h1 style="color:transparent;font-size:0px;">Aldersoft - We can help with all of your computing needs</h1>
<h2 style="color:transparent;font-size:0px;">Serving the computing needs of the Winnipeg, East St Paul and Selkirk areas.</h2>
What is the best SEO Tool ?
Why do I keep getting “too many redirects” when I retrieve the Home Page, but not any other page ?
Hence you have two WordPress installations: https://MySite.com/stage and https://MySite/prod. You normally want prod to be your “goto” WordPress site, so you put a redirect into the MySite.com “home” directory to send people automatically to prod. For example, you would create an index.php file in your home directory which contains the following redirect. (Note. The home directory is usually public_html in your cPanel File Manager.)
/* Redirect to MySite.com/prod with a permanent redirect */
header( ‘Location: https://MySite.com/prod/’, TRUE, 301 );
?>
Using our example, you need to add the following to the beginning of the .htaccess file in public_html/stage.
# Fix WordPress Permalink bug for URLS, not including index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^$ https://%{HTTP_HOST}/stage/index.php [R,L]
RewriteRule ^(.*)%{HTTP_HOST}$ $1%{HTTP_HOST}/stage/index.php [R,L]
RewriteRule ^(.*)%{HTTP_HOST}/$ $1%{HTTP_HOST}/stage/index.php [R,L]
</IfModule>
#END Aldersoft Permalink Fix
# Fix WordPress Permalink bug for URLS, not including index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^$ https://%{HTTP_HOST}/prod/index.php [R,L]
RewriteRule ^(.*)%{HTTP_HOST}$ $1%{HTTP_HOST}/prod/index.php [R,L]
RewriteRule ^(.*)%{HTTP_HOST}/$ $1%{HTTP_HOST}/prod/index.php [R,L]
</IfModule>
#END Aldersoft Permalink Fix
Then rebuild the URL to point to https://MySite.com/prod/index.php
EG. https://MySite.com/prod will have %{HTTP_HOST} of “MySite.com”
This will be rebuilt as https://MySite.com/prod/index.php
Lastly [R,L], says redirect (302) to the new URL, leave .htaccess, and start again.
Then rebuild the URL to point to https://mysite.com/prod/index.php
Lastly [R,L], says redirect (302) to the new URL, leave .htaccess, and start again.
Then rebuild the URL to point to https://MySite.com/prod/index.php
Lastly [R,L], says redirect (302) to the new URL, leave .htaccess, and start again.