Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
113 lines (97 loc) · 3.61 KB
/
Copy pathfunctions.php
File metadata and controls
113 lines (97 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
/* Remove Woocommerce footer credit */
add_action( 'init', 'custom_remove_footer_credit', 10 );
function custom_remove_footer_credit () {
remove_action( 'storefront_footer', 'storefront_credit', 20 );
// add_action( 'storefront_footer', 'custom_storefront_credit', 20 );
}
function custom_storefront_credit() {
?>
<div class="site-info">
Copyright © <?php echo get_the_date( 'Y' ) . ' ' . get_bloginfo( 'name'); ?>. All Rights Reserved. Address: No.28 Dongpu Sanli, Xiamen 361004 China
<br />
<!-- Your custom message goes here -->
</div><!-- .site-info -->
<?php
}
/* Edit required Checkout field */
/* https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ */
// Hook in
add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );
// Our hooked in function - $address_fields is passed via the filter!
function custom_override_default_address_fields( $address_fields ) {
$address_fields['country']['required'] = true;
$address_fields['address_1']['required'] = true;
$address_fields['city']['required'] = true;
$address_fields['state']['required'] = true;
$address_fields['postcode']['required'] = true;
return $address_fields;
}
// 关闭核心提示
add_filter('pre_site_transient_update_core', create_function('$a', "return null;"));
// "Best Sellers" Home products section
add_filter( 'storefront_best_selling_products_args', 'filter_storefront_best_selling_products_args', 10, 1 );
function filter_storefront_best_selling_products_args( $args ) {
$args['orderby'] = 'rand'; // Random
$args['limit'] = 12; // Total number of products presented
$args['columns'] = 4;
return $args;
}
// Custom Post Type for Bulletin Board
// Bulletin Board
function post_type_bulletin() {
register_post_type(
'bulletin',
array( 'public' => true,
'publicly_queryable' => true,
'hierarchical' => false,
'labels'=>array(
'name' => _x('Bulletin', 'post type general name'),
'singular_name' => _x('Bulletin', 'post type singular name'),
'add_new' => _x('Add New', 'Bulletin'),
'add_new_item' => __('Add New Bulletin'),
'edit_item' => __('Edit Bulletin'),
'new_item' => __('New Bulletin'),
'view_item' => __('Preview Bulletin'),
'search_items' => __('Search Bulletin'),
'not_found' => __('No Bulletin Found'),
'not_found_in_trash' => __('No Bulletin Found in Trash'),
'parent_item_colon' => ''
),
'show_ui' => true,
'menu_position'=>5,
'supports' => array(
'title',
'revisions' ) ,
'show_in_nav_menus' => true ,
'taxonomies' => array(
'menutype',
'post_tag')
)
);
}
add_action('init', 'post_type_bulletin');
function create_genre_taxonomy() {
$labels = array(
'name' => _x( 'Taxonomy', 'taxonomy general name' ),
'singular_name' => _x( 'genre', 'taxonomy singular name' ),
'search_items' => __( 'Search Taxonomy' ),
'all_items' => __( 'All Taxonomy' ),
'parent_item' => __( 'Parent Taxonomy' ),
'parent_item_colon' => __( 'Parent Taxonomy Colon:' ),
'edit_item' => __( 'Edit Bulletin Taxonomy' ),
'update_item' => __( 'Update Bulletin Taxonomy' ),
'add_new_item' => __( 'Add New Bulletin Taxonomy' ),
'new_item_name' => __( 'New Genre Name' ),
);
register_taxonomy('genre',array('bulletin'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
));
}
add_action( 'init', 'create_genre_taxonomy', 0 );