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 | |
// Add to functions.php | |
function fwp_combine_sources( $params, $class ) { | |
if ( 'MY_FACET_NAME' == $params['facet_name'] ) { | |
$value = get_field( 'YOUR_FIELD_1' ); | |
$params['facet_value'] = sanitize_title( $value ); | |
$params['facet_display_value'] = $value; | |
$class->insert( $params ); |
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 | |
$files = glob( __DIR__ . '/folder/*.php'); | |
foreach ($files as $file) { | |
require($file); | |
} |
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 | |
/* | |
* Dependent Plugin Activation/Deactivation | |
* | |
* Sources: | |
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/ | |
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/ | |
* | |
*/ | |
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
function _remove_script_version( $src ){ | |
$parts = explode( '?ver', $src ); | |
return $parts[0]; | |
} | |
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
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
development: | |
adapter: mysql2 | |
encoding: utf8 | |
database: my_database | |
username: root | |
roles: | |
- admin | |
- developer | |
- guest | |
password: |
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
// check Polylang exist | |
if ( function_exists('pll_register_string') ) { | |
$icelock_title_portfolio_section = get_theme_mod('icelock_title_portfolio_section', ''); | |
pll_register_string('Portfolio Section Title', $icelock_title_portfolio_section); | |
$icelock_title_team_section = get_theme_mod('icelock_title_team_section', ''); | |
pll_register_string('Team Section Title', $icelock_title_team_section); | |
$icelock_title_recent_post_section = get_theme_mod('icelock_title_recent_post_section', ''); | |
pll_register_string('Recent Post Section Title', $icelock_title_recent_post_section); | |
$icelock_title_testimonials_section = get_theme_mod('icelock_title_testimonials_section', ''); | |
pll_register_string('Testimonial Section Title', $icelock_title_testimonials_section); |
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
{ | |
"name": "shelob9/router-experiment", | |
"require": { | |
"silex/silex": "~1.3", | |
"twig/twig": "^2.0@dev" | |
}, | |
"minimum-stability": "dev", | |
"autoload": { | |
"psr-4": { | |
"shelob9\\router\\": "src" |
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 | |
/* set the url of the file to sideload - probably be from $_POST or something */ | |
$url = 'http://domain.com/image.jpg'; | |
/** | |
* donwload the url into wordpress | |
* saved temporarly for now | |
*/ | |
$tmp = download_url( $url ); |
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
Add to something like functions.php | |
// https://www.skyverge.com/blog/down-the-rabbit-hole-wordpress-and-timezones/ | |
function wp_get_timezone_string() { | |
// if site timezone string exists, return it | |
if ( $timezone = get_option( 'timezone_string' ) ) | |
return $timezone; | |
// get UTC offset, if it isn't set then return UTC |
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
// Remove Access to the course linked to the subscription key | |
function remove_course_access( $user_id, $subscription_key ) { | |
// Get the course ID related to the subscription | |
$subscription = WC_Subscriptions_Manager::get_subscription( $subscription_key ); | |
$courses_id = get_post_meta($subscription['product_id'], '_related_course', true); | |
// Update access to the courses | |
if ($courses_id && is_array($courses_id)) { | |
foreach ($courses_id as $course_id) { |