[WordPress] Creating custom post type and converting/changing post types of your post/page

Creating a custom post type is as simple as tweaking the code, saving it to your functions.php file or if you prefer to have it not bound to your theme then saving it to a code snippet plugin.

Follow this guide here. If you prefer to have the posts be categorized and taggable, then use the modified code below:

/* Custom Post Type Start */
function create_posttype_services() {
    register_post_type( 'service',
    // CPT Options
    array(
      'labels' => array(
       'name' => __( 'Services' ),
       'singular_name' => __( 'Service' )
      ),
      'public' => true,
      'has_archive' => false,
      'rewrite' => array('slug' => 'services'),
     )
    );
    }
    // Hooking up our function to theme setup
    add_action( 'init', 'create_posttype_services' );
    /* Custom Post Type End */
    
    /*Custom Post type start*/
    function cw_post_type_services() {
    $supports = array(
    'title', // post title
    'editor', // post content
    'author', // post author
    'thumbnail', // featured images
    'excerpt', // post excerpt
    'custom-fields', // custom fields
    'comments', // post comments
    'revisions', // post revisions
    'post-formats', // post formats
);
    $taxonomies = array(
    'category', // post title
    'post_tag', // post content
);
    $labels = array(
    'name' => _x('Services', 'plural'),
    'singular_name' => _x('Service', 'singular'),
    'menu_name' => _x('Services', 'admin menu'),
    'name_admin_bar' => _x('Services', 'admin bar'),
    'add_new' => _x('Add New', 'add new'),
    'add_new_item' => __('Add New Service'),
    'new_item' => __('New Services'),
    'edit_item' => __('Edit Services'),
    'view_item' => __('View Services'),
    'all_items' => __('All Services'),
    'search_items' => __('Search Services'),
    'not_found' => __('No Services found.'),
    );
    $args = array(
    'supports' => $supports,
    'taxonomies' => $taxonomies,
    'labels' => $labels,
    'public' => true,
    'query_var' => true,
    'rewrite' => array('slug' => 'services'),
    'has_archive' => true,
    'hierarchical' => false,
    );
    register_post_type('service', $args);
    }
    add_action('init', 'cw_post_type_services');
    /*Custom Post type end*/

You can simply change “service” and “services” to the singular and plural of your choice. I’ve bolded the only change I did.

Now that you’ve got your custom post added and working, like me you probably wanted to change some of your current posts. There’s a great plugin called Post Type Switcher, however it seems to not be getting updated anymore and failed to work. The next option is to use a SQL Query. Log in to your phpMyAdmin, head over to your wp_posts, find SQL on the menu and run the below command. Look further into this article for more information.

UPDATE wp_posts SET post_type = 'service' WHERE post_type = 'post'

Links & References

How to Create Custom Post Type in WordPress (Easy Guide)
https://www.cloudways.com/blog/wordpress-custom-post-type/

How to convert/change post type in WordPress – QuadLayers
https://quadlayers.com/change-post-type-in-wordpress/

Thunderbird 115 Common Issues

Missing folders/emails in Unified Folders view

Close Thunderbird, go to the profile folder and delete virtualFolders.dat file and Mail folder. Start Thunderbird.

Exporting/Importing Message Filters

When you create a message filter, each filter is saved within the emails folder, in a file called msgFilterRules.dat, so when importing or exporting you’ll need to retrieve the file for every email address.

C:\Users\<USER>\AppData\Roaming\Thunderbird\Profiles\<PROFILE>\ImapMail\<EMAIL>\msgFilterRules.dat

Thunderbird 115 Customizations

Hiding the number of messages under Message List Header

In Thunderbird Config Editor, find and change toolkit.legacyUserProfileCustomizations.stylesheets to “true”. Close Thunderbird.

In your profile folder, create a folder called “chrome”, then a file named “userChrome.css”, edit the file in any editor and add the following line:

#threadPaneFolderCount { display: none !important;}

Start up Thunderbird and it should now be hidden, if not, double check the config editor setting and the other steps if still further issue.

Changing tag background and font colours

Making sure Thunderbird is closed before you do any editing. Simply add on a new line, in the same file mentioned above.

/* Change the background color of tagged messages */
/* Tag name: Important */
treechildren::-moz-tree-cell(Timportant) {
    background-color: red !important;
}
treechildren::-moz-tree-cell-text(Timportant) {
    color: #FFF !important;
}

This should turn your emails, set with the tag “Important” to have a background colour of “red” (can be changed to another colour using HEX colours). Then the font colour to #FFFFFF (white).

Syncing files on Synology using a WebDAV server, with Joplin

My Synology is a bit outdated so the preferred or latest method seems to be with Docker, however I do not have that, so the alternative is the WebDAV method.

The first things you obviously need to do is download Joplin on your clients, installing on the PC and on Android, go to your synchronisation settings and it’ll ask you for a WebDAV URL, username and password.

Next create a location for the WebDAV server, specifically where our Joplin clients will look to when syncing their files.

Before you proceed you should decide on what you require, if this is purely an offline (no access to the internet) kind of syncing solution for yourself then you will not be able to use HTTPS unless you figure out and setup a local self-signed SSL certificate, whether that’s to your IP or an offline hostname.

Install & Setup WebDAV Server

On Synology (6.2), it’s a simple case of heading over to the Package Center and installing the WebDAV Server, once running go to settings and enable HTTPS (5006) and that’s it, at least for me. If you’re going the route where you’d like your notes to be synced via the internet then I wouldn’t turn on the HTTP, just to make it easier on securing the route.

In order for WebDAV to work via the internet, you need to create a DNS to point your dynamic IP or if you’ve got a static IP laying around skip all of that.

Purely HTTPS

FreeDNS, No-IP

Head over to one of the free DNS services/providers below and setup an account.

FreeDNS.com
http://www.freedns.com/

FreeDNS – Free DNS – Dynamic DNS – Static DNS subdomain and domain hosting
https://freedns.afraid.org/

Duck DNS
https://www.duckdns.org/

FreeDNS Alternatives: 25+ Dynamic DNS Services & Similar Apps | AlternativeTo
https://alternativeto.net/software/freedns/

Updating your dynamic IP

If you’ve got an option in your router to automatically update your IP (as it changes) to your dynamic DNS service/provider then you’re all set, simply provide the credentials and details it requires and your router does all the work.

If not you’ll have to either manually update it every time your router resets and changes IP or set up some kind of automation, there are some little apps/programs that keeps track, depending on the DNS service, you can see what’s compatiable.

I used DuckDNS and found that they’ve got a simple vbs script that can be run with Task Scheduler, which you can find out below.

Duck DNS – install
https://www.duckdns.org/install.jsp

I had to use a .bat file to run the command via CMD and get the .vbs script running or it stalled. Be sure to use pause or echo to test.

Add and export your certificate

Via the Synology (6.2) Control Panel, under Security, the Certificate tab, hit add and using the domain (sub domain) you created, fill in the details. Once done you can right click on the certificate and Export.

Install a certificate on Windows 10

Right click on your start menu and hit run, type “mmc” and OK, which should bring up the Microsoft Management Console (MMC), on the top left, under File menu, press Add/Remove Snap In, from the left, add to the right Certificates snap-in for Computer.

On the left, right click “Trusted Root Certification Authorities ” then under All Tasks, choose Import. Go through the process, I personally did automatic also right after.

Setup/add your new domain (sub domain)/hostname on Synology

Via the Synology (6.2) Control Panel, under External Access, press Add on the top and go through the process of adding your dynamic DNS service details. You’ll also have the option to configure your router there, if your router is on the list, if not then the manual way is below.

Install the required certificates to Configure Port Forwarding on your router

You’ll need to point any visitors to your external (public facing) IP that also use the port 5006 to forward to your local IP Synology server. So for example, your public IP address xxx.xxx.xxx.xxx:5006 would come to your router, the router will see that it’s has the port 5006 at the end of it and knows that the traffic for this port all must go to your Synology box at 192.168.0.100:5006, 5006 is being the WebDAV server we turned on earlier.

Install a certificate on Android

  1. Open your device’s Settings app.
    • Tap Security and privacy > Other security settings
  2. Under Credential Storage, Tap Install from device storage CA certificate.
  3. Tap where you saved the certificate.

Configuring Joplin

Once you’ve installed the certificates on your devices (to avoid TLS certificate errors), you should be able to input the URL, username and passwords.

Your URL should look something like this:
https://192.168.0.100:5006/vol1/joplinnotes/
https://yoursub.domain.org:5006/vol1/joplinnotes/

You can create a user specifically for Joplin use, but you’ll need to give it access. You’ll need to tweak the permissions where you only give it full access to the Joplin folder, allow it access to the parent folder so it can enter the directory, but not view anything else, other than what it’s been given, which is the joplin folder.

Links & References

Joplin in NAS Synology (webDAV) – Support – Joplin Forum
https://discourse.joplinapp.org/t/joplin-in-nas-synology-webdav/375/16

JST Connectors

The world of JST connectors, JST stands for Japan Solderless Terminal, that’s pretty much more than what you really need to know in my opinion other than the technicals. If you’re like me and only interested because you find yourself needing to replace a broken connector, well what I’ve rapidly figured out is you need to make sure you’re getting the correct size (duh), there’s obviously the basic questions you would know, such as how many pins, but they come in different sizes. 1mm, 1.25mm, 1.5mm, etc.

Your best bet is to actually measure your connector and look for an exact match. This page was a good starter on how to distinguish what you’re looking for.

Common JST Connector Types – Matt’s Tech Pages
https://www.mattmillman.com/info/crimpconnectors/common-jst-connector-types/

Then you either go to genuine sellers or you simply find what you’re looking for on eBay. You could go to Aliexpress, if you’re ok with waiting a very long time.

Links & References

Mini Micro JS 3 Pin Connector plug cable male and female new x 20 | eBay
https://www.ebay.co.uk/itm/115924260280

Mini Micro 3 pin for sale | eBay
https://www.ebay.co.uk/sch/i.html?_nkw=Mini+Micro+3+pin&_sacat=0

ZH 1.5mm Mini Micro JST Male for sale | eBay
https://www.ebay.co.uk/sch/i.html?_nkw=ZH+1.5mm+Mini+Micro+JST+Male&_sacat=0&LH_TitleDesc=0&_odkw=ZH1.5mm+Mini+Micro+JST+Male&_osacat=0

ZH 1.5mm 3-pin for sale | eBay
https://www.ebay.co.uk/sch/i.html?_nkw=ZH+1.5mm+3-pin&_sacat=0&LH_TitleDesc=0&rt=nc&LH_PrefLoc=1

JST ZH 1.5mm 3 pin for sale | eBay
https://www.ebay.co.uk/sch/i.html?_nkw=JST+ZH+1.5mm+3+pin&_sacat=0&LH_TitleDesc=0&_dmd=1&rt=nc

10PCS Mini Micro ZH 1.5mm 3 pin Jacks JST Connector with Wire YXSA | eBay
https://www.ebay.co.uk/itm/175923139881

2pcs JST ZH 1.5 3 Pin Male Female Connector Wires Cables 15cm Mini Micro FAST | eBay
https://www.ebay.co.uk/itm/155355658153

5 Set 2/3/4/5/6/7/8/9/10Pin ZH1.5mm Mini Micro JST Male 15cm Cable + Female XY | eBay
https://www.ebay.co.uk/itm/305030362711

JST ZH 1.5 3 Pin Male Female Connector Wires Cables X 5 15cm Mini Micro | eBay
https://www.ebay.co.uk/itm/303606530076

JST ZH 1.5mm 2-Pin 3-Pin 4-Pin Connector PCB Socket Wire Cable UK Seller | eBay
https://www.ebay.co.uk/itm/256210188764

15134-0402 Molex | Mouser United Kingdom
https://www.mouser.co.uk/ProductDetail/Molex/15134-0402?qs=lQAVKuKFhkLziWfc6y8Wzg%3D%3D&mgh=1&vip=1

Mini Micro JST 1.0 PH 3 Pin – Google Search
https://www.google.co.uk/imgres?imgurl=https%3A%2F%2Ftechmattmillman.s3.dualstack.us-east-1.amazonaws.com%2Fwp-content%2Fuploads%2F2021%2F01%2Falljst-800×520.jpg&tbnid=dAaz6qOxUKk19M&imgrefurl=https%3A%2F%2Fwww.mattmillman.com%2Finfo%2Fcrimpconnectors%2Fcommon-jst-connector-types%2F&docid=AQQUHzWNI_QCYM&w=800&h=520&q=Mini+Micro+JST+1.0+PH+3+Pin

Reset/clear NTFS Permissions

Ever hooked up an old drive and received error messages regarding permissions while copying or browsing through folders? There’s a simple way to reset and clear the user permissions for all the folders in one go.

Via Command prompt (admin) type the below code. In this case E:/ indicates that everything within the E drive will be reset. For more information on what the other parameters do, check out the below links.

icacls E:\ /reset

icacls E:\ /reset /t /c /l

Links & References

How to Reset NTFS Permissions Using a Simple, Free utility
https://blog.foldersecurityviewer.com/how-to-reset-ntfs-file-permissions/

reset all permissions for windows 10 and remove any unwanted hidden – Microsoft Community
https://answers.microsoft.com/en-us/windows/forum/all/reset-all-permissions-for-windows-10-and-remove/1d164613-781c-4bff-96e9-ce09649a1546

Icacls | Microsoft Learn
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc753525(v=ws.11)?redirectedfrom=MSDN

Takeown | Microsoft Learn
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/cc753024(v=ws.11)?redirectedfrom=MSDN

Quickly Reset NTFS Permissions in Windows 10
https://winaero.com/reset-ntfs-permissions-windows-10/

How to use ChatGPT

Step 1) Sign up

Sign up and login to https://beta.openai.com/signup

Step 2) Create an API key

If needed, create an API key via https://platform.openai.com/account/api-keys

Step 3) Use ChatGPT

https://chat.openai.com/

Use ChatGPT directly or use your api key to start a chat.

Links & References

Download Ungoogled Chromium and keep it updated

Step 1) Check your version

First things first, check your current version. Go to your settings on the top right and look for ‘About Chromium’. Or you can simply type:

chrome://settings/help

If you’ve not installed Ungoogled Chromium, obviously skip this step. Once you do install it, this will give you an idea of how far behind you are or will be compared to say Google Chrome after installing Ungoogled Chromium.

Step 2) Download Ungoogled Chromium

Head over to Ungoogled Chromium GitHub page, releases and check the latest version released: https://github.com/ungoogled-software/ungoogled-chromium/releases

You won’t be able to download as it’s just the source code provided, however head over to the below link for the windows download:

https://github.com/ungoogled-software/ungoogled-chromium-windows/releases

Alternatives

Alternatively using winchrome, which compiles a Windows version for us, we can download it over at:

https://github.com/macchrome/winchrome/releases

As you’ve checked the version, it’s important to be as close as possible to the release. Ungoogled Chromium strips out any Google code in Chromium, which means there’s a slight delay, and as we’re relying on someone to compile us a Windows version, there’s another delay.

This is not a huge deal if you’re a couple of days behind. Of course it means you’re vulnerable to the latest browser exploits.

Step 3) Keep your extensions up to date.

Extensions do not auto update. If you’re at this point and thinking maybe it’s not worth it, I would suggest using Mullvad Browser or LibreWolf. Or maybe Waterfox or Falkon.

If you’re still fine with the manual process. You will need to download and keep manually updating chromium-web-store in order to use extensions. You can then simply remove and re-add all your extensions to essentially update it.

To update, open ‘Manage extensions’ via the settings or go to:

chrome://extensions/

Check “details” of Chromium Web Store extension that you had downloaded, compare to latest version on GitHub, download if necessary. I like to go to the Chrome Web Store and either compare versions or just remove and re-add my extensions to make sure they’re all on the latest.

https://chrome.google.com/webstore/category/extensions

Building YouTube ReVanced with ReVanced CLI (Non-Root)

I’ve not yet completed this how-to, but this guide here is fantastic (web achieve backup).

Installing Java & Zulu OpenJDK

Links & References

revanced/revanced-cli: 💻 Command line application as an alternative to the ReVanced Manager
https://github.com/revanced/revanced-cli

Download YouTube APKs for Android – APKMirror
https://www.apkmirror.com/apk/google-inc/youtube/

Debloating/Uninstalling ‘System’ or locked Apps on Android (without Root)

In order to uninstall system apps, you generally need root access, optionally you can do this via ADB shell (Android Debug Bridge) shell = command line.

Install ADB

You can install ADB automatically or manually, the manual process consists of downloading the SDK platform tools:

SDK Platform Tools release notes  |  Android Studio  |  Android Developers
https://developer.android.com/tools/releases/platform-tools

Or if you’ve already got Android Studio downloaded, over SDK Manager > SDK Tools installed the package.

Commands

To connect:

adb shell

Then to list all the installed apps:

pm list packages

To narrow down or search for packages containing certain words:

pm list package | grep "youtube"

To uninstall:

pm uninstall --user 0 package-name
pm uninstall --user 0 com.google.android.youtube
pm uninstall --user 0 com.google.android.apps.youtube.music

To disable:

pm disable --user 0 package-name

Additional Information

How to uninstall carrier/OEM bloatware without root access
https://www.xda-developers.com/uninstall-carrier-oem-bloatware-without-root-access/

–user flag

The –user flag in the above command is important because it tells the system to uninstall the app for the current user only (and 0 is the default/main user of the phone). There is no way you can uninstall the app from all users unless you root the phone.

-k flag

-k option to keep the packages data and cache.

pm uninstall -k | XDA Forums
https://forum.xda-developers.com/t/pm-uninstall-k.4427021/

pm disable

How To Disable Any System App Bloatware On Android Without Root
https://www.xda-developers.com/disable-system-app-bloatware-android/

[Q] “pm disable” – Where’s it store the list? | XDA Forums
https://forum.xda-developers.com/t/q-pm-disable-wheres-it-store-the-list.2379517/

Apps that help copy & paste package names:

Package Names – Android Apps on Google Play
https://play.google.com/store/search?q=Package%20Names&c=apps&hl=en&gl=US

Debloater App removal Tools

0x192/universal-android-debloater: Cross-platform GUI written in Rust using ADB to debloat non-rooted android devices. Improve your privacy, the security and battery life of your device.
https://github.com/0x192/universal-android-debloater

[TOOL] ADB AppControl 1.8.0 🚀 Ultimate App Manager & Debloat Tool + Tweaks | XDA Forums
https://forum.xda-developers.com/t/tool-adb-appcontrol-1-8-0-ultimate-app-manager-debloat-tool-tweaks.4147837/