Tag Archives: how-to

[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/

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

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, this step is not necessary, but can also give you an idea of how far behind you are or will be 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

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

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/

How to Install ReVanced

Step 1 – Download the latest Vanced MicroG & ReVanced Manager

Create a folder on your device, upload or download all files to this folder, this is just so you can reference it later if needed.

  • Vanced MicroG
    Releases · TeamVanced/VancedMicroG
    https://github.com/TeamVanced/VancedMicroG/releases
  • ReVanced Manager
    Releases · revanced/revanced-manager
    https://github.com/revanced/revanced-manager/releases

Step 2 – Install Vanced MicroG on device

Go to the directory where you’ve downloaded Vanced MicroG with your preferred file manager. Run the APK file and install Vanced MicroG first.

Step 3 – Install & run ReVanced Manager

After Vanced MicroG is installed, ReVanaged Manager should be next, run it and give it the permissions it needs. Head over to the Patch tab (below) and like me you might find that you’re unable to patch your current install. If so you’ll need to continue, see Step 4.

Step 4 – Download recommended or latest YouTube APK file

It’s important to download a patched version to avoid bugging. Run the ReVanced Manager app, Select ‘Patcher’ tab, select YouTube and you should see current and suggested versions.

You can find it via the link Download YouTube APKs for Android – APKMirror. Download nodpi versions if you’re unsure.

Select the file from storage and allow it to patch the installer.

Optional Alternative – Uninstall using ADB shell or build using ReVanced CLI

If you get an error such as “App not installed as package conflicts with an existing package.” then you’ll need to make sure everything is completely uninstalled and trying again. As this will get pretty long I’ve created a different post, click the links below.

Using ADB Shell to uninstall

Build ReVanced with ReVanced CLI

YouTube links

Go to the YouTube app and under “set as default” – turn it off. Under YouTube ReVanced, make sure “Open supported links” is enabled and make sure within ‘supported web addresses” you’ve toggled all on.

Let’s fix YouTube links! – Hokora Yinphine
https://hokorayinphinempp.github.io/obsidian-git-sync/Revanced/5%20Extras/Fix%20Links/

Links & References

> I installed Vanced MicroG! – Hokora Yinphine
https://hokorayinphinempp.github.io/obsidian-git-sync/Revanced/2B%20Unrooted/MicroG%20Installed/

Guide For Installing YT Music ReVanced : r/revancedapp
https://www.reddit.com/r/revancedapp/comments/131beri/guide_for_installing_yt_music_revanced/

DNS ad-blocking & tracker-blocking, DNS over HTTPS (Secure DNS)

Blocking ads and trackers on a look up level is probably the most methodical approach as it means the entire network is protected from known malicious websites/IP’s. Setting up a switch to allow a Raspberry Pi to act as a DNS server is I guess the ultimate home setup, however that obviously requires a switch, Raspberry Pi and a little effort.

The next best thing is to manually set your devices to use DNS over HTTPS which adds some privacy and security to your DNS resolutions, but of course not stopping there and using a DNS provider that adds ad-blocking and tracker-blocking to the mix.

It’s still recommended to use a browser plugin like uBlock Origin and others like LocalCDN, Privacy Badger oh and personally I’d add Cookie AutoDelete, but blocking via DNS is for when you can’t use the former.

First port of call

Search what kind of service you prefer. The below link should give you a gist on what’s out there. I haven’t extensively tested to give you the best one.

Avoid The Hack: 7 Best DNS Providers for Privacy (and adblocking) | avoidthehack!
https://avoidthehack.com/best-dns-privacy

Blocking Ads, Trackers, and Malware in Browsers, Devices, and Networks | avoidthehack!
https://avoidthehack.com/how-to-block-ads

Mullvad DNS

To set one up quickly, I’d suggest Mullvad DNS.

DNS over HTTPS and DNS over TLS – Guides | Mullvad VPN
https://mullvad.net/en/help/dns-over-https-and-dns-over-tls/

DNS Leak test/connection test

Connection check | Mullvad VPN
https://mullvad.net/en/check

How-to

For Chromium it’s in the settings, and also if you wish to disable the fall-back it’s “chrome://flags/#dns-over-https” (then search for DnsOverHttpsMode) in the address bar to get to the settings.

Controversy

Secure DNS is a good thing, but centralized is not. Worth reading.

Centralised DoH is bad for privacy, in 2019 and beyond | PowerDNS Blog
https://blog.powerdns.com/2019/09/25/centralised-doh-is-bad-for-privacy-in-2019-and-beyond/

Bypass Windows 10/11 “Let’s Connect You to a Network” installation step

This is a just in case, if you find yourself with no internet and the latest installation packages seem to force you to connect to the internet. Here’s your options.

Disabling Windows 10 telemetry & other things

Via the Group Policy Editor.

Open up the Group Policy Editor by launching gpedit.msc as an administrator. Go through Computer Configuration > Administrative Templates > Windows Components > Data Collection and Preview Builds > Allow Telemetry

Microsoft has slightly changed some things so they may be worded differently. Such as Windows Defender is now called Microsoft Defender so older guides may not reflect that. Tamper protection needs to be also disabled.

Links & References