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_page_title', 'custom_woocommerce_page_title'); | |
function custom_woocommerce_page_title( $page_title ) { | |
$queried_object = get_queried_object(); | |
if ($queried_object->taxonomy == 'product_cat') { | |
$tid = $queried_object->parent; | |
while ($tid > 0) { | |
if ($parent_obj = get_term($tid, 'product_cat')) { | |
$tid = $parent_obj->parent; | |
$page_title = $parent_obj->name . ' > ' . $page_title; |
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 | |
/* | |
Template Name: Custom RSS Feed | |
*/ | |
$numposts = 5; | |
$numchars = 300; | |
$thumbformat = 'medium'; | |
$alt_text = 'Klik hier voor de afbeelding...'; |
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 your theme's functions.php file | |
add_action('wp_head', function() { | |
echo ' | |
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@type": "LocalBusiness", |
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 | |
set_time_limit(0); | |
ini_set('memory_limit', '1024M'); // should be enough for thousands of email addresses | |
$api_key = 'YOUR MAILBOXLAYER API KEY'; | |
$fp = fopen('emails-checked.csv', 'w'); | |
fputcsv($fp, array('Email address', 'Valid MX', 'Valid SMTP', 'Score')); | |
$count = 0; |
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 | |
// this is an example query from the link page on my website, use your own data and don't forget to change the names of the results inside the table below | |
$db = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); | |
$query = "SELECT title, descr, link FROM linksite ORDER BY vote DESC"; | |
$result = $db->query($query); | |
$total_records = $result->num_rows; // the number of records in your result set | |
while($row = $result->fetch_array()) { // store all records in an numbered array | |
$datarows[] = $row; | |
} |
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 in your theme's functions.php file | |
function fws_admin_prods_filter( $query ) { | |
global $pagenow; | |
if ( is_admin() && $pagenow == 'edit.php' && !empty($_GET['my_grouped_prods'])) { | |
$query->query_vars['post_parent'] = $_GET['my_grouped_prods']; | |
} | |
} | |
add_filter( 'parse_query', 'fws_admin_prods_filter' ); |
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_short_version($text, $len = 150, $trail = '...') { | |
$text = strip_tags($text); | |
$parts = explode(' ', $text); | |
$ic = count($parts); | |
for ($i = 0; $i > $ic; $i++) { | |
$txt .= $parts[$i].' '; | |
if (strlen($txt) >= $len) break; | |
} | |
$txt = trim($txt); |
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)) { |
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
<?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++) { |