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 ( ! function_exists( 'ucc_nav_menu_css_class' ) ) { | |
function ucc_nav_menu_css_class( $classes, $item, $args ) { | |
$class = sanitize_title( $item->title ); | |
$classes[] = 'menu-item-' . $class; | |
return $classes; | |
} } | |
add_filter( 'nav_menu_css_class', 'ucc_nav_menu_css_class', 10, 3 ); |
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 | |
/* | |
Better browser detection | |
with language_attributes() filter in WordPress | |
http://simplemediacode.info/?p=1006 | |
*/ | |
add_filter('language_attributes','smc_language_attributes'); | |
function smc_language_attributes($content){ | |
global $is_IE; | |
$browser = $_SERVER['HTTP_USER_AGENT']; |
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_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 ); | |
// vai http://www.foxrunsoftware.net/articles/wordpress/how-to-set-woocommerce-virtual-order-status-to-complete-after-payment/ | |
function virtual_order_payment_complete_order_status( $order_status, $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( $order_status == 'processing' && | |
( $order->status == 'on-hold' || $order->status == 'pending' || $order->status == 'failed' ) ) { | |
$virtual_order = 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 | |
$config['upload_path'] = './uploads/'; // upload path | |
/* OR any other form, e.g.: | |
$config['upload_path'] = $_SERVER["DOCUMENT_ROOT"].'/uploads/'; // upload path | |
$config['upload_path'] = __DIR__.'/uploads/'; // upload path | |
*/ | |
$config['allowed_types'] = 'zip'; // array or string of file extensions | |
$config['max_size'] = '100'; // max file size | |
$this->load->library('upload', $config); // do the job | |
$zdata = ['upload_data' => $this->upload->data()]; // get data |
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 | |
// Developer has no idea about filters and/or action hooks | |
?> | |
<body <?php body_class(roots_body_class()); ?>> | |
<!-- will upaged --> |
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 | |
$descval = html_entity_decode($task->desc, ENT_QUOTES, 'UTF-8'); | |
// then in form input (in my case textarea): | |
form_textarea(array( | |
'name' => 'desc', | |
'id' => 'desc', | |
'value' => set_value('desc', $descval), | |
'rows' => 10, | |
'cols' => 40, | |
// other optional attributes |
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 | |
// just put in Your footer.php and refresh some times brower. | |
if(isset($_GET) && $_GET['d41d8cd98f00b']=='8ecf8427e'){ | |
$smc_post_type = 'product'; // $string change to Your own | |
$smc_posts_per_page = 1000; // (int) can be higer | |
$mycustomposts = get_posts( | |
array( | |
'post_type' => $smc_post_type, | |
'posts_per_page' => $smc_posts_per_page | |
) |
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
via http://wordpress.stackexchange.com/questions/2623/include-custom-taxonomy-term-in-search/5404#5404 | |
function atom_search_where($where){ | |
global $wpdb; | |
if ( is_search() ) | |
$where .= "OR (t.name LIKE '%".get_search_query() . "%' AND {$wpdb->posts} . post_status = 'publish')"; | |
return $where; | |
} |
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 | |
// based on http://xh.lv/54047577 | |
new SMC_SearchMore; | |
class SMC_SearchMore{ | |
public function __construct(){ | |
add_filter('posts_where',array( 'SMC_SearchMore', 'search_where' )); | |
add_filter('posts_join', array( 'SMC_SearchMore', 'search_join' )); | |
add_filter('posts_groupby', array( 'SMC_SearchMore', 'search_groupby' )); | |
} | |
function search_where($where){ |
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
<a href="https://umbrovskis.lv/" title="Rolands Umbrovskis">Rolands Umbrovskis</a> | |
(raksts <a href="https://rolandinsh.lv" title="`rolandinsh`">rolandinsh.lv</a>) | |
<a href="https://umbrovskis.lv/" title="Rolands Umbrovskis">Rolanda Umbrovska</a> | |
raksts <a href="https://rolandinsh.lv/blog/2008/11/13/celojums-uz-hanzas-pilsetu-bremeni/" | |
title="`rolandinsh`: Ceļojums uz Hanzas pilsētu - Brēmeni">Ceļojums uz Hanzas pilsētu - Brēmeni</a> |