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 | |
//load current cw plus 4 weeks on front page date facet | |
add_filter( 'facetwp_preload_url_vars', function( $url_vars ) { | |
if ( '' == FWP()->helper->get_uri() ) {//frontpage | |
if ( empty( $url_vars['date_facet'] ) ) { | |
$week = date("W"); | |
$year = date("Y"); | |
$start_day = date("Y-m-d", strtotime("{$year}-W{$week}-1"));//return monday of this week | |
$end_day = date("Y-m-d", strtotime("{$year}-W{$week}-7 +3 weeks")); //return sunday in 4 weeks | |
//error_log($start_day); |
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 header links | |
*/ | |
/** | |
* Clean up wp_head() | |
* | |
* Remove unnecessary <link>'s | |
* Remove inline CSS and JS from WP emoji support |
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 | |
/** | |
Plugin Name: WooCommerce Extended Coupon Features PRO Daily Extension | |
Description: Extends WooCommerce Extended Coupon Features by adding coupons that are only valid on certain days | |
Author: Daniel Klose | |
Version: 1.0 | |
Author URI: http://www.daniel-klose.com/ | |
*/ | |
add_action( 'wjecf_init_plugins', 'setup_my_wjecf_example_plugin' ); |
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 DK_pll_rewrite_basic() { | |
add_rewrite_rule('(en|de)/(dashboard)/(product)/?$', 'index.php?lang=$matches[1]&pagename=dashboard&object=product', 'top'); | |
add_rewrite_rule('(en|de)/(dashboard)/(product)/(edit)/?$', 'index.php?lang=$matches[1]&pagename=dashboard&object=product&action=edit', 'top'); | |
//add_rewrite_rule('(en|ja)/(product-category)/(.+?)/?$', 'index.php?post_type=product&product_cat=$matches[3]', 'top'); | |
} | |
add_action('init', 'DK_pll_rewrite_basic', 10, 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 | |
add_filter('pll_redirect_home', 'home_redirection', 10); | |
function home_redirection($redirect) { | |
//$user_agent = $_SERVER['HTTP_USER_AGENT']; | |
//if(strpos( $user_agent, 'Yeti') !== false) { | |
$redirect = 'http://gogoespana.test/kr/'; | |
//} | |
return $redirect; | |
//return 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 | |
/* | |
* Test Redirect for Naver Search Engine | |
*/ | |
function gogoes_redirect_naver() { | |
$user_agent = $_SERVER['HTTP_USER_AGENT']; | |
if(strpos( $user_agent, 'Yeti') !== false) { | |
wp_redirect( pll_home_url('kr'), 301 ); | |
//header('Location: ' . pll_home_url('kr'), true, 301); | |
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
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( '' !== $query->get( 'facetwp' ) ) { | |
$is_main_query = (bool) $query->get( 'facetwp' ); | |
} | |
return $is_main_query; | |
}, 10, 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
$args = array( | |
'post_type' => array( 'smart-tours' ), | |
'posts_per_page'=>-1, | |
'orderby' => 'rand', | |
'facetwp' => 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 | |
/** | |
* I had a hard time accessing the Polylang PLL_Admin methods from the frontend. Instantiating classes manually didnt work. | |
* Luckily the Polylang boss jumped in and provided this solution. This shold also be working with other Polylang methods | |
* that can normally only be executed from admin side. | |
*/ | |
$pll = new PLL_Admin( PLL()->links_model ); | |
$pll->add_filters(); | |
$pll_pro = new Polylang_Pro(); | |
$pll_pro->load_modules( $pll ); |
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 | |
if ( ! defined("POST_VIEWS_KEY") ) { | |
define("POST_VIEWS_KEY", "post_views_count"); | |
} | |
// function to display number of posts. | |
function get_post_views( $post_id ){ |
NewerOlder