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 | |
ini_set('display_errors', 'On'); | |
error_reporting(E_ALL); | |
$filename = __DIR__ . '/request_log/' . date('Y-m-d_H-i-s') . '.log'; | |
$path = dirname($filename); | |
if (!file_exists($path) || !is_dir($path)) { | |
mkdir($path, 0777, true); |
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 | |
/** Display verbose errors */ | |
define( 'IMPORT_DEBUG', false ); | |
// Load Importer API | |
require_once ABSPATH . 'wp-admin/includes/import.php'; | |
if ( ! class_exists( 'WP_Importer' ) ) { | |
$class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php'; | |
if ( file_exists( $class_wp_importer ) ) |
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 excerpt_function($ID, $searchTerms) { | |
global $wpdb; | |
$thisPost = get_post_meta($ID); | |
foreach ($thisPost as $key => $value) { | |
if ( false !== stripos($value[0], $searchTerms) ) { | |
$found = substr(strip_tags($value[0]), 0, 150); | |
echo $found . ' ...'; | |
} | |
} | |
} |
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_shortcode( 'spotify', 'getSpotify' ); | |
function getSpotify(){ | |
// Add 'YOUR_CLIENT_ID' and 'YOUR_CLIENT_SECRET' with your actual Spotify API credentials | |
$client_id = ''; | |
$client_secret = ''; | |
$show_id = ''; | |
$ch = curl_init(); |
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('the_content', 'hjs_insert_content_after_chars_words'); | |
function hjs_insert_content_after_chars_words($content) { | |
// only do this if post is longer than 1000 characters | |
$enable_length = 1500; | |
// insert after the first </p> after 500 characters | |
$after_character = 1500; | |
if (is_single() && strlen($content) > $enable_length) { | |
$before_content = substr($content, 0, $after_character); | |
$after_content = substr($content, $after_character); |
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 | |
/** | |
* Recurring Events | |
* | |
* @package BE-Events-Calendar | |
* @since 1.0.0 | |
* @link https://github.com/billerickson/BE-Events-Calendar | |
* @author Bill Erickson <bill@billerickson.net> | |
* @copyright Copyright (c) 2014, Bill Erickson | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
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 | |
// Returns subtotal price ($5.00) | |
$cart_subtotal = WC()->cart->get_cart_subtotal(); | |
// Returns subtotal number value (5) | |
$cart_subtotal = WC()->cart->subtotal; | |
/*======================================== | |
Single Product |
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
/* Follow up for this thread: https://wordpress.org/support/topic/select-form-field-placeholder-option/ | |
- The first option of your select form must be the placeholder. | |
- Then, in your JQuery file, copy the code and replace "theName" and "theValue" with the data of your select. | |
Example: | |
---- On a HTML page ----- | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-latest.min.js"></script> | |
<script src="/yourJSfile.js"></script> |
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
<form action="/cart/add" method="post"> | |
{% if product.variants.size > 1 %} | |
{% if product.options[0] %} | |
<label for="select-one">{{ product.options[0] }}</label> | |
<select id="select-one" onchange="letsDoThis()"> | |
{% for value in product.options_with_values[0].values %} | |
<option value="{{ value }}" {% if product.options_with_values[0].selected_value == value %}selected{% endif %}> | |
{{ value }} | |
</option> | |
{% endfor %} |