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 | |
/*Only for debugging..*/ | |
error_reporting(E_ALL); | |
ini_set('display_errors', 'On'); | |
ini_set('max_execution_time', 0); // for infinite time of execution | |
// require wp-load.php to use built-in WordPress functions | |
require_once '../wp-load.php'; | |
require_once ABSPATH . 'wp-config.php'; | |
require_once ABSPATH . 'wp-includes/wp-db.php'; |
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 create_featured_image($image_url, $post_id) | |
{ | |
$upload_dir = wp_upload_dir(); | |
$image_data = file_get_contents($image_url, true); | |
if ($image_data === false) { | |
$article_id = '0'; | |
$featured_image = 'logo.png'; | |
$image_url = 'img/' . $article_id . '/'. $featured_image; |
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 | |
error_reporting(-1); // reports all errors | |
ini_set("display_errors", "1"); // shows all errors | |
ini_set("log_errors", 1); | |
ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0)'); | |
// https://github.com/MartinThoma/ics-parser/blob/master/class.iCalReader.php | |
require_once 'class.iCalReader.php'; |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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 | |
/*Disable comments from WordPress*/ | |
add_action('admin_init', function () { | |
// Redirect any user trying to access comments page | |
global $pagenow; | |
if ($pagenow === 'edit-comments.php') { | |
wp_redirect(admin_url()); | |
exit; | |
} |
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
/*Different depth of nodes will use different colour allowing you to see the size of each element on the page, their margin and their padding. Now you can easily identify inconsistencies. | |
*/ | |
* { background-color: rgba(255,0,0,.2); } | |
* * { background-color: rgba(0,255,0,.2); } | |
* * * { background-color: rgba(0,0,255,.2); } | |
* * * * { background-color: rgba(255,0,255,.2); } | |
* * * * * { background-color: rgba(0,255,255,.2); } | |
* * * * * * { background-color: rgba(255,255,0,.2); } | |
* * * * * * * { background-color: rgba(255,0,0,.2); } | |
* * * * * * * * { background-color: rgba(0,255,0,.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
/* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ | |
@media (min-width:320px) { | |
} | |
/* smartphones, Android phones, landscape iPhone */ | |
@media (min-width:480px) { | |
} |
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
/* Set the background color of body to tan */ | |
body { | |
background-color: tan; | |
} | |
/* On screens that are 1200px or less, set the background color to red */ | |
@media screen and (max-width: 1200px) { | |
body { | |
background-color: red; | |
} |
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
CREATE TABLE `users` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
`username` varchar(50) NOT NULL, | |
`first_name` varchar(50) NOT NULL, | |
`last_name` varchar(50) NOT NULL, | |
`email` varchar(100) NOT NULL, | |
`birth_date` date NOT NULL, | |
`password` varchar(100) NOT NULL, | |
`spol` varchar(2) NOT NULL, | |
`country` varchar(100) NOT NULL |
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 | |
session_start(); | |
// variable declaration | |
$username = ""; | |
$country = ""; | |
$email = ""; | |
$first_name = ""; | |
$last_name = ""; | |
$birth_date = ""; |