C:\xampp\htdocs\landing\wp-content\updraft\themes-old\pennews_\inc\breadcrumbs.php


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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<?php
/**
 * Display breadcrumbs for posts, pages, archive page with the microdata that search engines understand
 *
 * @see http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417
 *
 * @param array|string $args
 */
function penci_breadcrumbs$args '' )
{
    global 
$wp;

    
$args wp_parse_args$args, array(
        
'separator'         => '<i class="fa fa-angle-right"></i>',
        
'home_label'        => penci_get_tran_setting'penci_breadcrumb_home_label' ),
        
'home_class'        => 'home',
        
'before'            => '',
        
'before_item'       => '',
        
'after_item'        => '',
        
'taxonomy'          => 'category',
        
'display_last_item' => true,
        
'classes'           => ''
    
) );

    if( 
is_front_page() ){
        return;
    }
    
$use_yoast_breadcrumb penci_get_theme_mod'penci_use_yoast_breadcrumb' );

    if ( 
function_exists'yoast_breadcrumb' ) && $use_yoast_breadcrumb ) {
        
$yoast_breadcrumb yoast_breadcrumb'<div class="penci_breadcrumbs ">''</div>'false );

        if ( 
$yoast_breadcrumb ) {
            echo 
$yoast_breadcrumb;

            return;
        }
    }

    
$args apply_filters'penci_breadcrumbs_args'$args );

    
$items = array();
    
// HTML template for each item
    
$item_tpl      '<a href="%s" itemprop="item"><span itemprop="name">%s</span></a>';
    
$item_text_tpl '<span itemprop="item"><span itemprop="name">%s</span></span>';

    
// Home
    
if ( ! $args['home_class'] )
    {
        
$items[] = sprintf$item_tplesc_urlhome_url() ), esc_html$args['home_label'] ) );
    }
    else
    {
        
$items[] = sprintf(
            
'<a class="%s" href="%s" itemprop="item"><span itemprop="name">%s</span></a>',
                
esc_attr$args['home_class'] ),
                
esc_urlhome_url() ),
                
esc_html$args['home_label'] )
            );
    }

    
// Blog page, not Homepage
    
if ( is_home() && ! is_front_page() )
    {
        
$page get_option'page_for_posts' );
        if ( 
$args['display_last_item'] ) {
            
$items[] = sprintf$item_tplget_permalink$page ), get_the_title$page ) );
        }
    }elseif ( 
is_post_type_archive'portfolio' ) || is_tax'portfolio-category' ) ) {

        
$current_term get_queried_object();
        
$current_term_tax = isset( $current_term->taxonomy ) ? $current_term->taxonomy '';
        
$terms        penci_get_term_parentsget_queried_object_id(), $current_term_tax );

        foreach ( (array)
$terms as $term_id ) {
            
$term    get_term$term_id$current_term->taxonomy );
            
$items[] = sprintf$item_tplget_category_link$term_id ), $term->name );
        }

        
$current_term_label = isset( $current_term->label ) ?  $current_term->label $current_term->name;
        
$current_term_id = isset( $current_term->term_id ) ?  $current_term->term_id '';

        if ( 
$args['display_last_item'] ){
            
$items[] = sprintf$item_tplget_category_link$current_term_id ), $current_term_label );
        }

    }elseif ( 
is_single() ) {

        
// Terms
        
$terms get_the_termsget_the_ID(), $args['taxonomy'] );


        if ( ! 
is_wp_error$terms ) && ! empty( $terms ) ) {
            
$term    penci_bread_primary_termcurrent$terms ), $args['taxonomy'] );
            
$terms   penci_get_term_parents$term->term_id$args['taxonomy'] );
            
$terms[] = $term->term_id;
            foreach ( 
$terms as $term_id ) {
                
$term get_term$term_id$args['taxonomy'] );
                if ( ! 
is_wp_error$term ) && ! empty( $term ) ) {
                    
$items[] = sprintf$item_tplget_term_link$term$args['taxonomy'] ), $term->name );
                }
            }
            if ( 
$args['display_last_item'] ) {
                
$items[] = sprintf$item_tplget_permalink( ), get_the_title( ) );
            }
        }
    }
    elseif ( 
is_page() )
    {
        
$pages penci_get_post_parentsget_queried_object_id() );
        foreach ( 
$pages as $page )
        {
            
$items[] = sprintf$item_tplget_permalink$page ), get_the_title$page ) );
        }
        if ( 
$args['display_last_item'] )
            
$items[] = sprintf$item_tplget_permalink( ), get_the_title( ) );
    }
    elseif ( 
is_tax() || is_category() || is_tag() )
    {
        
$current_term get_queried_object();
        
$terms        penci_get_term_parentsget_queried_object_id(), $current_term->taxonomy );

        foreach ( 
$terms as $term_id ) {
            
$term    get_term$term_id$current_term->taxonomy );
            
$items[] = sprintf$item_tplget_category_link$term_id ), $term->name );
        }

        
$current_term_label = isset( $current_term->label ) ? $current_term->label '';
        
$current_term_id    = isset( $current_term->term_id ) ? $current_term->term_id '';

        if( ! 
$current_term_label ) {
            
$current_term_label = isset( $current_term->name ) ? $current_term->name '';
        }

        if ( 
$args['display_last_item'] ) {
            
$items[] = sprintf$item_tplget_category_link$current_term_id ), $current_term_label );
        }
    }
    elseif ( 
is_search() )
    {
        
$items[] = sprintf$item_tpl,get_search_linkget_search_query() ), sprintfesc_html__'%s &quot;%s&quot;''pennews' ), penci_get_tran_setting'penci_search_title' ), get_search_query() ) );
    }
    elseif ( 
is_404() )
    {
        
$items[] = sprintf$item_tplpenci_get_tran_setting'penci_breadcrumb_page_404' ) );
    }
    elseif ( 
is_author() )
    {
        
$author_url get_author_posts_urlget_the_author_meta'ID' ) );

        
// Queue the first post, that way we know what author we're dealing with (if that is the case).
        
$items[] = sprintf(
            
$item_tpl,
            
$author_url,
            
sprintf(
                
esc_html__'%s %s''pennews' ),
                
penci_get_tran_setting'penci_breadcrumb_author_archive' ),
                
'<span class="vcard"><a class="url fn n" href="' $author_url '" title="' esc_attrget_the_author() ) . '" rel="me">' get_the_author() . '</a></span>'
            
)
        );
    }
    elseif ( 
is_day() )
    {
        
$items[] = sprintf(
            
$item_tpl,
            
home_urladd_query_arg( array(), $wp->request ) ),
            
sprintfesc_html__'%s %s''pennews' ),penci_get_tran_setting'penci_breadcrumb_day_archive' ), get_the_date() )
        );
    }
    elseif ( 
is_month() )
    {
        
$items[] = sprintf(
            
$item_tpl,
            
home_urladd_query_arg( array(), $wp->request ) ),
            
sprintfesc_html__'%s %s''pennews' ),penci_get_tran_setting'penci_breadcrumb_monthly_archives' ), get_the_date'F Y' ) )
        );
    }
    elseif ( 
is_year() )
    {
        
$items[] = sprintf(
            
$item_tpl,
            
home_urladd_query_arg( array(), $wp->request ) ),
            
sprintfesc_html__'%s %s''pennews' ),penci_get_tran_setting'penci_breadcrumb_yearly_archives' ), get_the_date'Y' ) )
        );
    }
    else
    {
        
$items[] = sprintf(
            
$item_tpl,
            
home_urladd_query_arg( array(), $wp->request ) ),
            
penci_get_tran_setting'penci_breadcrumb_archives' )
        );
    }


    
$items apply_filters'penci_breadcrumbs_items'$items$item_tpl$item_text_tpl );

    
$output =  '<div class="penci_breadcrumbs ' esc_attr$args['classes'] ) . '">';
    
$output .=  '<ul itemscope itemtype="http://schema.org/BreadcrumbList">';
    
$output .=  ( $args['before'] );

    
$pos_item 1;
    foreach( 
$items as $item )  {



        
$output .= $args['before_item'];
        
$output .= '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';

        if( 
$pos_item ) {
            
$output .= $args['separator'];
        }
        
$output .= $item;
        
$output .= sprintf'<meta itemprop="position" content="%s" />'absint$pos_item ) );
        
$output .= '</li>';
        
$output .= $args['after_item'];

        
$pos_item ++;
    }

    
$output .= '</ul>';
    
$output .= '</div>';

    echo ( 
$output );
}

/**
 * Searches for term parents' IDs of hierarchical taxonomies, including current term.
 * This function is similar to the WordPress function get_category_parents() but handles any type of taxonomy.
 * Modified from Hybrid Framework
 *
 * @param int|string    $term_id  The term ID
 * @param object|string $taxonomy The taxonomy of the term whose parents we want.
 *
 * @return array Array of parent terms' IDs.
 */
if( ! function_exists'penci_get_term_parents' ) ) {
    function 
penci_get_term_parents$term_id ''$taxonomy 'category' ) {
        
// Set up some default arrays.
        
$list = array();

        
// If no term ID or taxonomy is given, return an empty array.
        
if ( empty( $term_id ) || empty( $taxonomy ) ) {
            return 
$list;
        }

        do {
            
$list[] = $term_id;

            
// Get next parent term
            
$term    get_term$term_id$taxonomy );
            
$term_id $term->parent;
        } while ( 
$term_id );

        
// Reverse the array to put them in the proper order for the trail.
        
$list array_reverse$list );
        
array_pop$list );

        return 
$list;
    }
}

/**
 * Gets parent posts' IDs of any post type, include current post
 * Modified from Hybrid Framework
 *
 * @param int|string $post_id ID of the post whose parents we want.
 *
 * @return array Array of parent posts' IDs.
 */
if( ! function_exists'penci_get_post_parents' ) ) {
    function 
penci_get_post_parents$post_id '' ) {
        
// Set up some default array.
        
$list = array();

        
// If no post ID is given, return an empty array.
        
if ( empty( $post_id ) ) {
            return 
$list;
        }

        do {
            
$list[] = $post_id;

            
// Get next parent post
            
$post    get_post$post_id );
            
$post_id $post->post_parent;
        } while ( 
$post_id );

        
// Reverse the array to put them in the proper order for the trail.
        
$list array_reverse$list );
        
array_pop$list );

        return 
$list;
    }
}


if( ! 
function_exists'penci_bread_primary_term' ) ) {

    function 
penci_bread_primary_term$term$taxonomy ){
        if ( 
class_exists'WPSEO_Primary_Term' ) ) {
            
$wpseo_primary_term = new WPSEO_Primary_Term$taxonomyget_the_id() );
            
$wpseo_primary_term $wpseo_primary_term->get_primary_term();
            
$primary_term       get_term$wpseo_primary_term );

            if ( ! 
is_wp_error$primary_term ) ) {
                
$term $primary_term;
            }
        }

        return 
$term;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586