Skip to content

Instantly share code, notes, and snippets.

View crazyyy's full-sized avatar

Vitalii Antoniuk crazyyy

View GitHub Profile
@crazyyy
crazyyy / other-wp-seo.php
Created September 15, 2023 01:38
WordPress SEO Yoast improvements
<?php
/**
* Set the custom Open Graph image URL for specific conditions.
* Add custom Twitter Social Share images for Yoast SEO for Archive pages
*
* @param string $image The default Open Graph image URL.
* @return string The custom Open Graph image URL, or the default URL if not found.
*/
function artkai_set_custom_category_og_image($image) {
@crazyyy
crazyyy / wpeb-fix-featured-images.php
Created September 15, 2023 01:33
This plugin automatically sets the first embedded image as the featured image for new posts that do not have a specified featured image.
@crazyyy
crazyyy / wp-seo-yoast-multidomain.md
Created September 15, 2023 00:47
Get Wordpress working on multiple domains with single instance, with correct Yoast canonical, open graph, schema

This code modifies various URLs in WordPress generated by the Yoast SEO plugin to replace the domain with the current domain.

Here's a breakdown of what the code does:

  1. The code adds filters to various Yoast SEO functions in the functions.php file to modify specific URLs. These filters ensure that the URLs are updated with the current domain.

  2. The change_domain_in_link function is a callback function used by the filters. It takes a URL as input and replaces the domain in the URL with the current domain. It uses the str_ireplace function to perform the replacement.

  3. The recursive_array_search_callback function is a helper function used by the change_domain_in_links function. It recursively searches for a specific value in a multidimensional array and applies a callback function to the found value. In this case, it is used to search for URLs starting with "https://" in the schema graph data.

@crazyyy
crazyyy / __readme.md
Last active September 20, 2023 23:44
#scoop #pwsh #powershell Scoop App Manager

Scoop

scoop export installed apps

# https://github.com/ScoopInstaller/Scoop/issues/1543
(scoop export) | sls '^([\w\._-]+) .* \[(.*)\]$' |% { "$($_.matches.groups[2])/$($_.matches.groups[1])" }
@crazyyy
crazyyy / _readme.md
Last active August 22, 2024 18:17
PageSpeed Lighthouse
@crazyyy
crazyyy / _readme.md
Last active September 21, 2024 21:03
#wordpress #php || Snipets

Other Snippets

If / Else load Pages

  if ( is_front_page() && is_home() ){
      // Default homepage
  } elseif ( is_front_page()){
      //Static homepage
  } elseif ( is_home()){
@crazyyy
crazyyy / _readme.md
Last active February 16, 2024 07:03
📱 #adb #fastboot Favorite Android

Android

Favorite Android, ADB and Fastboot Snippets

@crazyyy
crazyyy / GoogleMapsApi.js
Created March 3, 2020 13:11
#js || A simple class for loading the Google Maps Javascript API in browser async using ES6 and Promise
/**
* Use this class to ensure Google Maps API javascript is loaded before running any google map specific code.
*/
export class GoogleMapsApi {
/**
* Constructor set up config.
*/
constructor() {
// api key for google maps