Today I read about the WordPress Block Editor. I don’t use it (I use the code editor) but I suppose it’s good to know what it can do.
Tag Archives: wordpress
Fixing duplication in HTML title element for WordPress with Yoast SEO installed
I was having a problem in WordPress for my blog where the title contained duplicate values, like “John’s blogJohn’s blog”.
The fix for me was to edit wp-content/themes/twentyeleven/header.php and disable a bit of the output, as shown below. I basically just added an if ( false ) to disable the code which caused the duplicate content.
This seems to effectively mean that Yoast SEO is in charge of the titles now. You can configure separately the homepage, posts, and pages titles in the Yoast SEO settings. I configure mine in Yoast SEO Settings / Content Types like this:
- Homepage
- Site title Separator Tagline
- Posts
- Title Separator Site title
- Pages
- Title Separator Site title
<title>
<?php
// Print the <title> tag based on what is being viewed.
global $page, $paged;
wp_title( '|', true, 'right' );
// 2024-07-14 jj5 - OLD: I removed this because wp_title() (above) does everything that needs to be done.
if ( false ) {
// Add the site name.
bloginfo( 'name' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
echo " | $site_description";
}
// Add a page number if necessary:
if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
/* translators: %s: Page number. */
echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ) );
}
}
?>
</title>
New WordPress plugins for the blog
I have been rolling out CloudFront for a few of my domains, including blog.jj5.net.
In order to integrate CloudFront with WordPress I used the W3 Total Cache plugin.
And in order to set the <link rel=”canonical”> element I used the Yoast SEO plugin.
At one point I had a problem with garbled content in my browser. Looked like the browser was trying to display compressed content as text. But now I can’t reproduce, so hopefully whatever the issue was it is now fixed…
New look
After around 12 years with a completely unreadable look and feel I have finally bowed to pressure and switched my WordPress theme over to something sensible. I’m using the Twenty Eleven theme, which is what the old unreadable theme (known as OldSkool) was based on. This change is as a courtesy to my readers, who I do actually value. :)
Use ufw to disable traffic to WordPress on web-server
So on the server to ban IP 1.2.3.4 use something like this:
ufw default allow incoming ufw default allow outgoing ufw deny from 1.2.3.4 to any ufw enable
This assumes that your server is also protected by AWS security groups. If not, be careful, because it opens up pretty much complete access.
Comments per page in WordPress
Today I wanted to change the number of comments per page from 20 to 200 but I didn’t know how. Turns out you can adjust this by clicking ‘Screen Options’ (top right) and picking a new value.
WordPress theme development
Reading about WordPress theme development. Found the anatomy of a WordPress theme.
Support for OpenID
WordPress post email notifications
Was looking for how to get WordPress to send email about new posts and found Post Notification a WordPress plugin that claims to do just that. Haven’t installed it yet.
FFS WordPress
The famous five minute quick installation, my ass!
Firstly, I’ve just discovered FileZilla, and now I don’t have to upload my files one by one! When I didn’t know about FileZilla and FTP, I used my hosting provider’s web-based interface to upload HTML files to my web-site one-by-one. I’m glad those days are gone!
In the beginning days when I just wrote my own HTML files that was cool, because I only had about 10 files. But now that I’m learning to be a WordPress master I need FTP, and FileZilla rocks! (Thanks to jj5 for the recommendation!)
In the five minute install it said do you have a MySQL server, and I was like “yeah”, but then when I uploaded WordPress it said that my version of MySQL wasn’t high enough! They didn’t tell me *that* in the five minute install instructions!
And now on another one of my WordPress web-sites I have a random error with a stray < character in the wp-settings.php config file and the whole site is broken. I don’t even know who to blame for that!
In conclusion I take my hat off to people who have WordPress sites, because it’s not as easy to get it set up as it says in the manual. You still have to know computers to get it going I guess.