Skip to content

Instantly share code, notes, and snippets.

@FmiKL
FmiKL / cron_lib.php
Created September 6, 2025 09:46
Minimal PHP script to run cron jobs via remote URLs with optional cooldown handling.
<?php
// cron_lib.php — shared helper for cron job scripts
/**
* Call a remote job URL with cURL and exit with a proper status code.
* Optional cooldown: skip run if last run is too recent.
*
* exit(0) = success (or intentionally skipped due to cooldown)
* exit(1) = failure
*/
@FmiKL
FmiKL / sticky-panel.js
Created September 4, 2025 05:20
Vanilla JS script that makes a panel stick below the header while scrolling and then pins it at the bottom of its anchor area.
(function() {
/* Sticky panel: stays below the header, then pins at the bottom of the anchor */
const STICKY_BREAKPOINT = 992;
const STICKY_OFFSET = 95;
if (window.innerWidth < STICKY_BREAKPOINT) return;
const anchor = document.querySelector('.js-sticky-anchor');
const panel = document.querySelector('.js-sticky-floating');
if (!anchor || !panel) return;
@FmiKL
FmiKL / OdooApiClient.php
Created December 13, 2023 20:06
This class is used to interact with an Odoo server using XML-RPC protocol. It provides methods to login and fetch data from the Odoo server.
<?php
use PhpXmlRpc\Value;
use PhpXmlRpc\Client;
use PhpXmlRpc\Request;
/**
* This class is used to interact with an Odoo server using XML-RPC protocol.
* It provides methods to login and fetch data from the Odoo server.
*/
@FmiKL
FmiKL / functions.php
Created December 9, 2023 12:09
Change the textarea field to the HTML editor on the taxonomy creation and editing page in the WordPress admin
<?php
/**
* Replaces the default `Description` field in the `Add New Term` form.
*
* @param string $taxonomy The taxonomy of the new term.
*/
function replace_description_field_add( $taxonomy ) {
?>
<div class="form-field term-description-wrap">
<label for="tag-description"><?php _e( 'Description' ); ?></label>
@FmiKL
FmiKL / functions.php
Created December 9, 2023 12:08
Completely remove Gutenberg editor from WordPress admin
<?php
/**
* Disables Gutenberg for posts.
*/
add_filter( 'use_block_editor_for_post', '__return_false' );
/**
* Disables Gutenberg for widgets.
*/
add_filter( 'use_widgets_block_editor', '__return_false' );
@FmiKL
FmiKL / functions.php
Last active March 21, 2024 16:50
Use WordPress comments as a guestbook with addition directly from the admin
<?php
/**
* Displays a custom comment form.
*/
function custom_comment_form() {
?>
<div id="custom-comment-form" class="wrap">
<h1>Add to comments</h1>
<form method="post">
<table class="form-table">