Skip to content

Instantly share code, notes, and snippets.

{
"status": "success",
"search_nag": {},
"code": 0,
"bookmark": "b28xMDB8MDQ0NWZiOTBjNzNiODlkOTQ1ZTk3ZjY0ZTBhYjU0YjM0ZDYyNDg3NjU3ZWQ3OGJmZjI4ZTliZGRmODBlMzJlNQ==",
"debug_data": {
"query_data": {}
},
"message": "ok",
"data": [
@iwek
iwek / save_wp_error.php
Last active September 15, 2024 16:02
Send WordPress Plugin Activation Errors to a File
<?php
add_action('activated_plugin','save_error');
function save_error(){
file_put_contents(ABSPATH. 'wp-content/plugins/PLUGIN_FOLDER/error.html', ob_get_contents());
}
?>
@iwek
iwek / plugin_admin_page_function.php
Last active December 31, 2015 08:28
Building a WordPress Plugin Admin Page with a Function
<?php
add_action('admin_menu', 'plugin_admin_add_page');
function plugin_admin_add_page() {
add_options_page('Custom Plugin Page', 'Custom Plugin Options Page', 'manage_options', 'page_slug', 'plugin_options_page'); //settings menu page
}
function plugin_options_page() {
//HTML and PHP for Plugin Admin Page
echo "<h2>The Custom Plugin Options Page</h2>";
}
@iwek
iwek / plugin_admin_page.php
Last active June 20, 2020 03:57
Building a WordPress Plugin Admin Menu Page
<?php
add_action('admin_menu', 'plugin_admin_add_page');
function plugin_admin_add_page() {
//http://codex.wordpress.org/Function_Reference/add_menu_page
add_menu_page( 'custom menu title', 'custom menu', 'manage_options', 'dbexplorer/adminpage.php');
}
function my_enqueue($hook) {
//only for our special plugin admin page
if( 'dbexplorer/adminpage.php' != $hook )
@iwek
iwek / adminpage.php
Created December 14, 2013 22:34
wp query
<?php
//http://codex.wordpress.org/Class_Reference/wpdb
global $wpdb;
echo "<h2>Plugin Admin Page</h2>";
$arr = $wpdb->get_results("SELECT * FROM $wpdb->users");
echo '<div id="dt_example"><div id="container"><form><div id="demo">';
echo '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"><thead><tr>';
@iwek
iwek / qc.php
Created December 14, 2013 23:37
Quick Contact WordPress Plugin Part 1
<?php
/**
* @package Quick Contact
* @version 0.1
*/
/*
Plugin Name: Quick Contact
Plugin URI: http://techslides.com/
Description: Quick Contact WordPress Plugin to make an Ajax form submission, store it in the database, and show it in a Admin backend page.
Version: 0.1
@iwek
iwek / wp_plugin_ajax.php
Last active June 20, 2020 03:57
Ajax in Wordpress
<?php
/**
* @package Quick Contact
* @version 0.1
*/
/*
Plugin Name: Quick Contact
Plugin URI: http://techslides.com/
Description: Quick Contact WordPress Plugin to make an Ajax form submission, store it in the database, and show it in a Admin backend page.
Version: 0.1
/*!
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill
* Copyright (c) 2011 Addy Osmani
* Dual licensed under the MIT and GPL licenses.
*/
(function () {
window.visibly = {
b: null,
q: document,
@iwek
iwek / file1.txt
Last active August 29, 2015 14:06
update gist
String file contents are now updated
@iwek
iwek / file1.txt
Last active August 29, 2015 14:06
updated gist via ajax
updated String file contents via ajax