Repository navigation
Expand file tree
/
Copy pathfunctions.php
More file actions
executable file
·159 lines (149 loc) · 4.92 KB
/
Copy pathfunctions.php
File metadata and controls
executable file
·159 lines (149 loc) · 4.92 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
// Setup theme
if ( ! function_exists( 'minwp_setup' ) ) :
function minwp_setup() {
register_nav_menus( array(
'primary' => esc_html__( 'Main Menu', 'minwp' ),
'footer' => esc_html__( 'Footer Menu', 'minwp' ),
));
}
endif; //minwp_setup
add_action( 'after_setup_theme', 'minwp_setup' );
// Register sidebars
if ( ! function_exists( 'minwp_widgets_init' ) ) :
function minwp_widgets_init() {
register_sidebar(
array(
'name' => __( 'Right Side Widget Area', 'minwp' ),
'id' => 'primary',
'description' => __( 'Widgets in right sidebar.', 'minwp' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Top Widget Area', 'minwp' ),
'id' => 'header',
'description' => __( 'Widgets in top.', 'minwp' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Bottom Left Widget Area', 'minwp' ),
'id' => 'bottom-left',
'description' => __( 'Widgets in bottom left.', 'minwp' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Bottom Middle Widget Area', 'minwp' ),
'id' => 'bottom-middle',
'description' => __( 'Widgets in bottom middle.', 'minwp' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => __( 'Bottom Right Widget Area', 'minwp' ),
'id' => 'bottom-right',
'description' => __( 'Widgets in bottom right.', 'minwp' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
endif; //minwp_widgets_init
add_action( 'widgets_init', 'minwp_widgets_init' );
// Display date info of post
if ( ! function_exists( 'minwp_posted_on' ) ) :
function minwp_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$posted_on = sprintf(
_x( '%s', 'post date', 'minwp' ), $time_string );
echo $posted_on;
}
endif; //minwp_posted_on
// Display tags and categories
if ( ! function_exists( 'minwp_entry_meta' ) ) :
function minwp_entry_meta() {
if ( 'post' == get_post_type() ) {
$categories_list = preg_replace('/<a /', '<a class="post-category post-category-color-1"', get_the_category_list( ' ' ));
if ( $categories_list ) {
printf( '<span class="links__cat">%1$s %2$s</span>',
_x( ' Categories: ', 'Used before category names.', 'minwp' ),
$categories_list
);
}
$tags_list = preg_replace('/<a /', '<a class="post-category post-category-color-2"', get_the_tag_list( ' ' ));
if ( $tags_list ) {
printf( ' <span class="links__tag">%1$s %2$s</span>',
_x( 'Tags:', 'Used before tag names.', 'minwp' ),
$tags_list
);
}
}
}
endif; //minwp_entry_meta
if ( ! function_exists( 'minwp_excerpt_more' ) ) :
function minwp_excerpt_more( $more ) {
return '';
}
endif; //minwp_excerpt_more
add_filter('excerpt_more', 'minwp_excerpt_more'); // remove [...]
remove_filter( 'the_excerpt', 'wpautop' ); // remove p container tag
// Navigation links
if ( ! function_exists( 'minwp_paging_nav' ) ) :
function minwp_paging_nav() {
if ( $GLOBALS['wp_query']->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $GLOBALS['wp_query']->max_num_pages,
'current' => $paged,
'mid_size' => 3,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( '← Previous', 'blm_basic' ),
'next_text' => __( 'Next →', 'blm_basic' ),
'type' => 'list',
) );
if ( $links ) :
?>
<h3 class="content-subhead">Posts navigation</h3>
<?php echo $links; ?>
<?php
endif;
}
endif; //minwp_paging_nav