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 | |
// functions.php | |
function forceLogin(){ | |
if(!is_user_logged_in()){ | |
$redirect = TRUE; | |
foreach(['wp-admin', 'wp-login'] as $url) { | |
if(strpos($_SERVER['REQUEST_URI'], $url) !== FALSE){ | |
$redirect = FALSE; |
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
<table id="bodyTable" border="0" width="100%" cellspacing="0" cellpadding="0" align="left"> | |
<tbody> | |
<tr> | |
<td id="bodyCell" style="padding-bottom: 40px;" align="center" valign="top"> | |
<!-- BEGIN TEMPLATE // --> | |
<table border="0" width="100%" cellspacing="0" cellpadding="0"> | |
<tbody> | |
<tr> | |
<td align="center" valign="top"> | |
<!-- BEGIN PREHEADER // --> |
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
<center></center> | |
<table id="bodyTable" border="0" width="100%" cellspacing="0" cellpadding="0" align="left"> | |
<tbody> | |
<tr> | |
<td id="bodyCell" style="padding-bottom: 40px;" align="center" valign="top"><!-- BEGIN TEMPLATE // --> | |
<table border="0" width="100%" cellspacing="0" cellpadding="0"> | |
<tbody> | |
<tr> | |
<td align="center" valign="top"><!-- BEGIN PREHEADER // --> | |
<!-- // END PREHEADER --></td> |
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 | |
register_post_type( 'book', array( | |
'public' => true, | |
'label' => __( 'Books', 'textdomain' ), | |
)); |
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 | |
$client = Aws\Ec2\Ec2Client::factory([ | |
'region' => 'eu-west-1', | |
'version' => '2016-11-15', | |
'credentials' => [ | |
'key' => 'YOUR KEY', | |
'secret' => 'YOUR SECRET', | |
] | |
]); |
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 City extends WP_Model | |
{ | |
public $postType = 'city'; | |
public $attributes = [ | |
'latitude', | |
'longitude' | |
]; |
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 City extends WP_Model{ | |
public $postType = 'city'; | |
public $attributes = [ | |
'population', | |
]; | |
public $filter = [ | |
'population' |
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 //functions.php | |
add_action("wp_ajax_example", "exampleAJAX"); | |
add_action("wp_ajax_nopriv_example", "exampleAJAX"); | |
function exampleAJAX(){ | |
echo "Success!"; | |
} |
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
$.post(ajaxurl, {action: "example"}) | |
.done(function(data) { | |
console.log(data) | |
}); |
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 Example extends WP_AJAX | |
{ | |
protected $action = 'example'; | |
protected function run(){ | |
echo $this->get('foo'); // 'bar' | |
echo $this->get('baz'); // NULL |