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 | |
/* | |
Using this function you can use different values on the frontend while keeping the original strings or translations. | |
How to use: | |
Place the PHP code below into the functions.php file from your WordPress child theme. | |
If you like, change the strings inside the quotes for the $status variables. | |
The action hook will place the information below the add to cart button (based on the original WooCommerce template files). | |
*/ |
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 | |
// place this code into you child theme's functions.php file | |
// Do you use Advanced Custom Fields? Uncomment the next row, otherwise the custom fields meta box doesn't show up in your edit post screen | |
//add_filter('acf/settings/remove_wp_meta_box', '__return_false'); | |
add_action( 'init', 'fws_elementor_submissions_post_type' ); | |
function fws_elementor_submissions_post_type() { | |
$args = array( | |
'public' => false, |
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 check_url($url) { | |
if (substr($url, 0, 4) != 'http') { | |
$url = 'http://'.$url; | |
} | |
$response = get_headers($url); | |
if ($response[0] == 'HTTP/1.1 200 OK') { | |
return $url; | |
} elseif (in_array(substr($response[0], 9, 3), array(302, 301))) { | |
foreach ($response as $r) { |
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 | |
require_once __DIR__.'/../vendor/autoload.php'; | |
try { | |
$cache = new PageCache\PageCache(); | |
$cache->config() | |
->setCachePath('/your/cache_path/') | |
->setEnableLog(true) | |
->setCacheExpirationInSeconds(86400); | |
$cache->init(); | |
} catch (\Exception $e) { |
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 | |
echo ' | |
<a href="http://mydomain.com/download.php?download_file=some_file.pdf">PHP download file</a>'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Ajax Live Search - DEMO</title> | |
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<link href="starter-template.css" rel="stylesheet"> |
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 | |
add_filter( 'woocommerce_registration_error_email_exists', function( $html ) { | |
$url = wc_get_page_permalink( 'myaccount' ); | |
$url = add_query_arg( 'redirect_checkout', 1, $url ); | |
$html = str_replace( 'Please log in', '<a href="'.$url.'"><strong>Please log in</strong></a>', $html ); | |
return $html; | |
} ); | |
add_filter( 'woocommerce_login_redirect', function( $redirect, $user ) { | |
if ( $_GET['redirect_checkout'] ) { |
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 | |
include_once 'ServerPilot.php'; | |
include_once 'ServerPilotException.php'; | |
function randomPassword($pw_length = 8) { | |
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; | |
$pass = array(); | |
$alphaLength = strlen($alphabet) - 1; | |
for ($i = 0; $i < $pw_length; $i++) { |
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 | |
// Enter here your server UID and the login / password | |
$uid = 'xxx-xxx-xxx-xxx-xxx'; | |
$host = 'https://api.upcloud.com/1.2/server/'.$uid; | |
$username = 'XXX'; | |
$password = 'XXXXXXXX'; |
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
function showRating($id, $css_class = 'post-ratings') { | |
global $wpdb; | |
$path = plugins_url('wp-postratings/images/'.get_option('postratings_image')); | |
$rating = $wpdb->get_var("SELECT AVG(rating_rating) AS rating FROM $wpdb->ratings WHERE rating_postid = $id"); | |
$i = 0; | |
$html = ' | |
<span class="'.$css_class.'">'; | |
if (!empty($rating)) { | |
while ($i > floor($rating)) { |