Skip to content

Instantly share code, notes, and snippets.

View Niq1982's full-sized avatar

Niku Hietanen Niq1982

View GitHub Profile
@Niq1982
Niq1982 / global.js
Last active July 28, 2023 11:32
Load Youtube videos using iFrame API
import ytPlayer from './ytplayer.js';
// Find players from DOM and load if found
const players = document.querySelectorAll('.youtube-player');
players.forEach(player => new ytPlayer(player, {
height: player.dataset.height ? player.dataset.height : 1280,
width: player.dataset.width ? player.dataset.width : 780,
autoplay: player.dataset.autoplay ? player.dataset.autoplay : false,
videoId: player.dataset.videoId ? player.dataset.videoId : false,
}));
@Niq1982
Niq1982 / wpcli-ai1wm.md
Last active February 21, 2024 04:00
Site migration using All in One WP Migration and WP CLI

Do a backup

Install the plugin

wp plugin install all-in-one-wp-migration --activate

You must reload the page once before continuing

Do the backup

@Niq1982
Niq1982 / README.md
Created February 26, 2024 09:11
Installing xdebug on ARM MacOS and VSCode

Install Xdebug

# Make sure you are using arm64 executable
> file `which php`
/opt/homebrew/bin/php: Mach-O 64-bit executable arm64

# Install
> arch -arm64 pecl install xdebug
@Niq1982
Niq1982 / card.php
Last active April 9, 2024 17:00
Load more to WordPress blog archive using AlpineJS and Axios
<div class="card">
<?php if ($args['link']) : ?>
<a href="<?php echo esc_url($args['link']); ?>" class="global-link">
</a>
<?php endif; ?>
<div class="card-image">
<?php wp_get_attachment_image($args['image']); ?>
</div>