This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MySampleClass { | |
use Hookable; | |
public static function register_hooks() { | |
static::add_action( 'wp_footer' ); | |
static::add_filter( 'the_content', 100 ); | |
static::add_filter( 'admin_title', 100, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Fragment } from "@wordpress/element"; | |
import { createHigherOrderComponent } from "@wordpress/compose"; | |
import { addFilter } from "@wordpress/hooks"; | |
import { TextControl } from "@wordpress/components"; | |
import { useSelect } from '@wordpress/data'; | |
import { useEntityProp } from '@wordpress/core-data'; | |
import { useBlockProps, PlainText } from '@wordpress/block-editor'; | |
const AddSubtitle = createHigherOrderComponent((BlockEdit) => { | |
const AddSubtitle = (props) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function login_user_by_un_id( $un = false, $id = false ) { | |
$user = $un ? get_user_by( 'login', $un ) : get_user_by( 'id', intval( $id ) ); | |
if ( $user && ! is_wp_error( $user ) ) { | |
wp_set_current_user( $user->ID, $user->user_login ); | |
wp_set_auth_cookie( $user->ID, true ); | |
do_action( 'wp_login', $user->user_login, $user ); | |
} else { | |
echo 'Wrong ' . ( $un ? 'username' : 'user ID' ) . '!'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is right after | |
// if ( $attachment_count > 0 && ! has_shortcode( $post_content, 'gallery' ) ) { | |
// I realize now that it should actually be in a separate if that doesn't include the ! has_shortcode() condition | |
// 3D seems to be included when sending email via Apple Mail like so: | |
// src=3D"...." | |
preg_match_all( '/<img(.*?)src=3?D?[\'"]cid:([^"\']*)[\'"]([^<>]*)\/?>/ims', $post_content, $inline_image_matches ); | |
if ( $inline_image_matches ) { | |
$search_array = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function load_js_template(){ | |
get_template_part( 'sample-template' ); | |
} | |
add_action( 'wp_footer', 'load_js_template' ); | |
function render_template( $template_name, $tmpl_data ) { | |
// "/" should not be present, but let's sanitize just in case | |
$template_name = str_replace( '/', '_', $template_name ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Resize images dynamically using wp built in functions | |
* Based on the script by Victor Teixeira | |
* - Updated to use wp_get_image_editor() | |
* - Moves resized files to uploadpath/resized/ | |
* Joe Swann | |
* | |
* php 5.2+ | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: AWD Weight/Country Shipping | |
* Plugin URI: http://www.andyswebdesign.ie/blog/free-woocommerce-weight-and-country-based-shipping-extension-plugin/ | |
* Description: Unofficial update for WooCommerce 2.1. Weight and Country based shipping method for Woocommerce. | |
* Version: 1.0.2b | |
* Author: Andy_P | |
/* Copyright 2012 andyswebdesign.ie | |
This program is free software; you can redistribute it and/or modify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a simple plugin that allows you to create "switchable" content blocks. | |
A "switchable" block is a block of content that can be placed inside of a post/page/widget via a shortcode and be turned on/off globally from a single page in the admin. | |
After activating the plugin, just go to "Switchable Contents > Add New" and enter your title and content(the title is generally used for organizational purposes only). | |
The content of each block is wrapped in <div class="switchable-content switchable-content-visible">, but if you want to customize the output, simply copy the "switchable-content-template.php" file in your theme's root directory and do any changes there. | |
You can easily have a default message that will be displayed when a block is disabled, or you can add some text before/after the content. You have no limitations in how to use the template :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Google XML Sitemaps - Media support | |
Description: This plugin will display all of your media in the automatically generated sitemap created by the Google XML Sitemaps plugin v 4.0+ | |
Version: 1 | |
Author: Nikola Nikolov | |
Author URI: http://paiyakdev.com/ | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
NewerOlder