PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / lib / frontend / walker / class-quadmenu-item-post-type.php

class-quadmenu-item-post-type.php in QuadMenu – Mega Menu 3.3.8, at lib/frontend/walker/class-quadmenu-item-post-type.php

82 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace QuadLayers\QuadMenu\Frontend\Walker;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 die( '-1' );
6 }
7 use QuadLayers\QuadMenu\Frontend\Walker\QuadMenu_Item;
8
9 /**
10 * QuadMenuItemPostType Class
11 */
12 class QuadMenu_Item_Post_Type extends QuadMenu_Item {
13
14 protected $type = 'post_type';
15
16 function init() {
17
18 if ( 0 < $this->depth ) {
19
20 $this->args->has_thumbnail = (bool) ( $this->item->thumb );
21
22 $this->args->has_subtitle = (bool) $this->args->has_subtitle;
23
24 $this->args->has_excerpt = (bool) ( $this->item->excerpt == 'on' );
25
26 if ( $this->args->has_thumbnail ) {
27 $this->args->has_badge = false;
28 }
29
30 if ( $this->args->has_excerpt ) {
31
32 $this->args->has_subtitle = false;
33
34 if ( ! $this->item->description ) {
35
36 $post = get_post( $this->item->object_id );
37
38 if ( isset( $post->post_excerpt ) ) {
39 $this->item->description = wp_trim_words( wpautop( $this->clean_item_content( $post->post_excerpt ? $post->post_excerpt : $post->post_content ) ), 10 );
40 $this->args->has_description = true;
41 } else {
42 $this->args->has_excerpt = false;
43 }
44 }
45 }
46 }
47 }
48
49 function get_start_el() {
50
51 $item_output = '';
52
53 $this->add_item_classes();
54
55 $this->add_item_classes_prefix();
56
57 $this->add_item_classes_current();
58
59 $this->add_item_classes_post_type();
60
61 $this->add_item_classes_quadmenu();
62
63 $id = $this->get_item_id();
64
65 $class = $this->get_item_classes();
66
67 $item_output .= '<li' . $id . $class . '>';
68
69 $this->add_link_atts();
70
71 $this->add_link_atts_toggle();
72
73 $item_output .= $this->get_link();
74
75 return $item_output;
76 }
77
78 function add_item_classes_post_type() {
79 $this->item_classes[] = 'quadmenu-item-type-post_type';
80 }
81 }
82