Skip to content

Instantly share code, notes, and snippets.

@jeyhunmikayil
jeyhunmikayil / WP_Query_Args.php
Created March 5, 2023 21:04 — forked from fazlurr/WP_Query_Args.php
WP_Query arguments list
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@jeyhunmikayil
jeyhunmikayil / test.php
Last active January 28, 2023 23:34
Pass variables to get_template_part function in Wordpress 5.5 +
<?php
/*
Originally asnwer https://stackoverflow.com/questions/51569217/wordpress-get-template-part-pass-variable
Starting in WordPress 5.5, the template loading functions will
now allow additional arguments to be passed through to the matched
template file using a new $args parameter.
get_template_part( string $slug, string $name = null, array $args = null )
@jeyhunmikayil
jeyhunmikayil / resolv.conf
Created January 24, 2023 17:03
Error: DNS record for <domain> doesn’t exist - HestiaCP Let's Encrypt Error
# While applying Let's Encrypt SSL in HesiaCP it shows DNS error
# to resolve it just change contents of /etc/resolv.conf to
# Solution >> https://forum.hestiacp.com/t/error-dns-record-for-domain-doesnt-exist/2580/4
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001: 4860: 4860 :: 8888
nameserver 2001: 4860: 4860 :: 8844
@jeyhunmikayil
jeyhunmikayil / woo-events.js
Created March 10, 2022 20:13 — forked from bagerathan/woo-events.js
[Woocommerce Javascript events] #woo
//Woocommerce Checkout JS events
$( document.body ).trigger( 'init_checkout' );
$( document.body ).trigger( 'payment_method_selected' );
$( document.body ).trigger( 'update_checkout' );
$( document.body ).trigger( 'updated_checkout' );
$( document.body ).trigger( 'checkout_error' );
//Woocommerce cart page JS events
$( document.body ).trigger( 'wc_cart_emptied' );
$( document.body ).trigger( 'update_checkout' );
@jeyhunmikayil
jeyhunmikayil / findCreate.py
Created February 21, 2021 00:42 — forked from portableant/findCreate.py
Restore innodb from frm and ibd files only
import argparse
import os
import re
parser = argparse.ArgumentParser(description='Process file.')
parser.add_argument('-f', '--file', help='The filename', required=True)
args = parser.parse_args()
def create_file(file):
print(file)
@jeyhunmikayil
jeyhunmikayil / gist:a1b16977ff6d979dd7ec636297d46430
Created February 14, 2021 21:54 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@jeyhunmikayil
jeyhunmikayil / wl-api.php
Created January 22, 2021 20:10 — forked from ivandoric/wl-api.php
WordPress Rest API Custom Endpoints Video Tutorials Notes - Check out the videos: https://www.youtube.com/watch?v=C2twS9ArdCI and https://www.youtube.com/watch?v=76sJL9fd12Y
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
@jeyhunmikayil
jeyhunmikayil / upload-a-file.MD
Created January 16, 2021 11:42 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@jeyhunmikayil
jeyhunmikayil / Example 1
Created January 8, 2021 22:18 — forked from alexpos/Example 1
Several examples how to use python-wordpress-xmlrpc to post to wordpress
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import NewPost
#authenticate
wp_url = "http://192.168.50.100:8051/xmlrpc.php"
wp_username = "admin"
wp_password = "12"
wp = Client(wp_url, wp_username, wp_password)
#post and activate new post

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents