Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Crocoblock / cct-crud.md
Last active June 22, 2024 20:37
JetEngine CCT CRUD

Get/Create/Update/Delete CCT item

Check if CCT module active

$module_active = jet_engine()->modules->is_module_active( 'custom-content-types' );

Get type object and handler

$type_object is an instance of \jet-engine\includes\modules\custom-content-types\inc\factory.php \

@akotulu
akotulu / fns_tinybrowser.php
Last active November 14, 2022 21:28
TinyMCE's tinybrowser plugin Flash replacement
<?php
// Removed deprecated functions
// sql_regcase
/* Create Folder */
function createfolder($dir, $perm)
{
// prevent hidden folder creation
$dir = ltrim($dir, '.');
@Moc
Moc / regex.php
Created February 19, 2019 15:41
<?php
$string1 = '<link href="/css/bs4-dynamic-fields-form-2.min.css" rel="stylesheet" media="screen">';
$string2 = '<script src="/cdn-cgi/apps/head/qx0HK83qWJ5I3r2xnETN-ETfo6s.js"></script>"';
$regex1 = '~<link(.*?)href="([^"]+)"(.*?)>~';
$regex2 = '/src=(["\'])(.*?)\1/';
$result1 = preg_match($regex1, $string1, $matches1);
$result2 = preg_match($regex2, $string2, $matches2);
@rniswonger
rniswonger / wp-disable-plugin-update.php
Last active January 3, 2024 15:21
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@nonsintetic
nonsintetic / readme.md
Last active January 19, 2024 10:57
PHP - Get YouTube subscriber count with Youtube API v3

How to:

Here's a 'simple' way to get the YouTube subscriber number from Google's Youtube API v3:

  1. Go to https://console.developers.google.com/apis/library
  2. Log in with your Google account.
  3. Next to the logo click on 'Project' and 'Create project'. Name it whatever you want and click on 'Create'.
  4. Wait until the project is created, the page will switch to it by itself, it will take a couple of seconds up to a minute. Once it's done it will be selected next to the logo.
  5. Once it's created and selected, click on 'Credentials' from the menu on the left.
  6. Click on 'Create Credentials' and choose 'API Key'. You can restrict it to specific IPs, or types of requests (website, android, ios etc.) if you want, it's safer that way.
@letanure
letanure / bootstrap-all-elements.html
Created June 14, 2016 10:07
List of all bootstrap components
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap all elements</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
@MicBrain
MicBrain / metatags.html
Last active April 8, 2024 12:53
The list of useful meta tags used in HTML5 documents.
<html>
<head>
<!--Recommended Meta Tags-->
<meta charset="utf-8">
<meta name="language" content="english">
<meta http-equiv="content-type" content="text/html">
<meta name="author" content=”Rafayel Mkrtchyan”>
<meta name="designer" content=”Rafayel Mkrtchyan”>
<meta name="publisher" content=”Rafayel Mkrtchyan”>
@robmint
robmint / pagination.php
Last active October 29, 2019 11:14
Pagination like flickr, digg, github - the standard pagination pattern
<?php
// based on the work of Jason Coleman
// http://www.strangerstudios.com/blog/2006/07/paginate-your-site-like-digg/
/* The pagination function simply spits out a data structure
that you can render any way you like.
See also the javascript version for node:
https://gist.github.com/robmint/4651cf1c6f336e663dba
*/
@asalkey
asalkey / woo-email.php
Created October 9, 2015 17:33
Programmatically trigger WooCommerce email
<?php
$mailer = WC()->mailer();
$mails = $mailer->get_emails();
if ( ! empty( $mails ) ) {
foreach ( $mails as $mail ) {
if ( $mail->id == 'wc_reminder_email' ) {
$mail->trigger();
}
}
@vielhuber
vielhuber / index.php
Last active July 17, 2023 14:20
load wpdb outside in external php file #php #wordpress
<?php
// minimal version
define( 'SHORTINIT', true );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
// medium version (With lots of overhead)
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
// full version (including functions and 200 header)
define( 'SHORTINIT', true );