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 additional_active_item_classes( $classes = array(), $menu_item = false ) { | |
// custom taxonomy | |
if ( $menu_item->title == 'Custom Tax Name Page' && is_tax('custom_tax') ) { | |
$classes[] = 'current-menu-item'; | |
} | |
// custom post type single | |
if ( $menu_item->title == 'Custom Post Type Page' && is_singular('products') ) { | |
$classes[] = 'current-menu-item'; |
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 | |
$args = array('cat' => 'home','post_type' => 'post')); | |
$post_obj = new WP_Query($args); | |
while($post_obj->have_posts() ) : $post_obj->the_post(); | |
//display comments | |
$comments = get_comments(array( | |
'post_id' => $post->ID, | |
'number' => '2' )); | |
foreach($comments as $comment) { | |
//format comments |
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
UPDATE wp_options SET option_value = replace(option_value, 'OLD URL', 'NEW URL') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = replace(post_content, 'OLD URL', 'NEW URL'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'OLD URL','NEW URL'); | |
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'OLD URL','NEW URL'); | |
UPDATE wp_links SET link_url = replace(link_url, 'OLD URL','NEW URL'); | |
UPDATE wp_comments SET comment_content = replace(comment_content , 'OLD URL','NEW URL'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'OLD URL', 'NEW URL'); | |
UPDATE wp_links SET link_image = replace(link_image, 'OLD URL','NEW URL'); | |
UPDATE wp_posts SET guid = replace(guid, 'OLD URL','NEW URL'); |
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 custom column */ | |
function woo_add_user_nip_column( $columns ) { // e.g. NIP | |
$columns['billing_company_nip'] = __( 'NIP', 'theme' ); | |
return $columns; | |
} | |
add_filter( 'manage_users_columns', 'woo_add_user_nip_column' ); |
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 | |
/// without prefix | |
$current_url = "//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; | |
/// with prefix | |
global $wp; | |
$current_url = home_url( add_query_arg( array(), $wp->request ) ); |
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 displayLocationDropdown() { | |
$html = ''; | |
$html .= '<form class="location-select" method="post">'; | |
$html .= '<select id="location-selector" name="location" class="location">'; | |
$tag = wp_tag_cloud( array( | |
'format' => 'array', |
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 | |
/* hide uncategorized product category */ | |
add_filter( 'woocommerce_product_categories_widget_args', 'custom_woocommerce_product_subcategories_args' ); | |
function custom_woocommerce_product_subcategories_args( $args ) { | |
$args['exclude'] = get_option( 'default_product_cat' ); | |
return $args; | |
} |
NewerOlder