Skip to content

Instantly share code, notes, and snippets.

View drinkmaker's full-sized avatar
🏠
Working from home

Alexander Khmelnitskiy drinkmaker

🏠
Working from home
View GitHub Profile
@akingdom
akingdom / editable-dropdown.html
Last active September 5, 2024 17:36
Example of a basic editable HTML dropdown (SELECT menu).
<html>
<!--
This replaces the SELECT dropdown menu with an editable INPUT textbox,
when the last ('other') option is selected from the list.
Note that this may not be a good fit when supplying both display values and raw values,
as evidenced by the 'spanish' option.
By Andrew Kingdom (C) 2023 all rights reserved. MIT License.
-->
@Rahmon
Rahmon / get_post_categories.php
Last active June 21, 2023 11:43
Get the post categories preserving the hierarchical order (WordPress)
<?php
/**
* Get the post categories preserving the hierarchical order
*
* This function returns an array with the following structure
*
* [
* [parent_term_id] => [
* [children] => [
* [child_term_id] => [
@miguelmota
miguelmota / external_link_arrow.txt
Last active September 18, 2024 02:37
Unicode UTF-8 external link arrow symbol (closest thing to it)
@hansschuijff
hansschuijff / install-wp-plugins.php
Last active April 1, 2024 05:03 — forked from squarestar/install-wp-plugins.php
Programmatically install and activate wordpress plugins
<?php
/**
* Plugin Name: Activate required plugins.
* Description: Programmatically install and activate plugins based on a runtime config.
* Version: 1.0
* Author: Hans Schuijff
* Author URI: http://dewitteprins.nl
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@qumberrizvi
qumberrizvi / bitbucket-pipelines.yml
Last active September 11, 2023 06:30
Bitbucket Pipelines CI/CD: SSH into a server to git pull without conflict. Avoid failure when auto merge tries to open editor for commit message.
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.29
pipelines:
default:
- step:
name: Deploy to dev
@digisavvy
digisavvy / Is current page using Elementor?
Created May 28, 2020 01:00
A simple check if the current page is using ELementor
<?php // Do not include this line.
$post_id = get_the_ID(); // Set post ID var.
if ( Elementor\Plugin::instance()->db->is_built_with_elementor( $post_id ) ) {
echo 'fuck yeah it is!';
}
@TimothyBJacobs
TimothyBJacobs / .env
Created December 19, 2019 03:18
Testing WordPress Plugins with Codeception on Bitbucket Pipelines using Docker Compose
DB_PORT=9119
WP_PORT=7253
WP_TAG=latest
@edlefebvre
edlefebvre / fragment-caching.php
Created October 8, 2019 13:27
Fragment caching function
<?php
/**
* Fragment caching function
* see: https://css-tricks.com/wordpress-fragment-caching-revisited/
*
* Usage:
* <?php fragment_cache('frc_footer', DAY_IN_SECONDS, function() { ?>
* code to cache (loops etc)
* <?php }); // end fragment_cache ?>
*/
@iqbalrony
iqbalrony / wp-custom-reset-password-form.php
Last active September 12, 2024 12:16
WordPress custom reset password form
<?php
/*
*Example Follw:-https://code.tutsplus.com/tutorials/build-a-custom-wordpress-user-flow-part-3-password-reset--cms-23811
*/
// Create the custom pages at plugin activation
register_activation_hook( __FILE__, 'dgm_plugin_activated' );
function dgm_plugin_activated() {
// Information needed for creating the plugin's pages
$page_definitions = array(
@webmandesign
webmandesign / gutenberg-wide-alignement-wrapper.php
Last active September 9, 2020 17:14
Wrapping aligned Gutenberg blocks with additional div on a WordPress website front-end.
<?php
// IMPORTANT UPDATE 20190307:
// Since WordPress 5.0.0 we can actually use much simpler solution:
/**
* Applies wrapper div around aligned blocks.
*
* Copy this function into your WordPress theme's `functions.php` file
* and change the `themeprefix` accordingly.