質問編集履歴
1
解決した際のコードを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -31,4 +31,69 @@
|
|
31
31
|
|
32
32
|
利用しているjQueryのバージョンは1.10.2です。
|
33
33
|
また、プラグインmixitupのサイトはこちらです。
|
34
|
-
[https://www.kunkalabs.com/mixitup/](https://www.kunkalabs.com/mixitup/)
|
34
|
+
[https://www.kunkalabs.com/mixitup/](https://www.kunkalabs.com/mixitup/)
|
35
|
+
|
36
|
+
---
|
37
|
+
|
38
|
+
### 【最終追記】
|
39
|
+
どなたかのお役に立つことがあるかもしれないので、修正後のコードを記載しておきます。
|
40
|
+
|
41
|
+
```PHP
|
42
|
+
<nav class="box">
|
43
|
+
<?php
|
44
|
+
$args = array(
|
45
|
+
'menu' => 'global-navigation',
|
46
|
+
'menu_class' => 'globalnavi',
|
47
|
+
'container' => false,
|
48
|
+
'walker' => new edit_Walker_Nav_Menu()
|
49
|
+
);
|
50
|
+
wp_nav_menu($args);
|
51
|
+
?>
|
52
|
+
</nav>
|
53
|
+
```
|
54
|
+
|
55
|
+
```PHP
|
56
|
+
class edit_Walker_Nav_Menu extends Walker_Nav_Menu {
|
57
|
+
function start_el( &$output, $item, $depth, $args ) {
|
58
|
+
// メニュー内の各項目に対する処理
|
59
|
+
if (in_array('menu-item-type-custom', $item->classes)) {
|
60
|
+
// カスタムリンクが対象
|
61
|
+
$output .= $this->create_b_tag($item, $depth, $args);
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
// カスタムリンク以外
|
65
|
+
$output .= $this->create_a_tag($item, $depth, $args);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
private function create_a_tag($item, $depth, $args) {
|
69
|
+
// link attributes
|
70
|
+
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
|
71
|
+
$item_output = sprintf( '<li>%1$s<a%2$s>%3$s%4$s%5$s</a>%6$s',
|
72
|
+
$args->before,
|
73
|
+
$attributes,
|
74
|
+
$args->link_before,
|
75
|
+
apply_filters( 'the_title', $item->title, $item->ID ),
|
76
|
+
$args->link_after,
|
77
|
+
$args->after
|
78
|
+
);
|
79
|
+
return apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
80
|
+
}
|
81
|
+
|
82
|
+
private function create_b_tag($item, $depth, $args) {
|
83
|
+
// link attributes
|
84
|
+
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
|
85
|
+
// data-filterにtitle属性を利用
|
86
|
+
$title = $item->attr_title ;
|
87
|
+
$item_output = sprintf( '<li data-filter="%7$s">%1$s<a%2$s>%3$s%4$s%5$s</a>%6$s',
|
88
|
+
$args->before,
|
89
|
+
$attributes,
|
90
|
+
$args->link_before,
|
91
|
+
apply_filters( 'the_title', $item->title, $item->ID ),
|
92
|
+
$args->link_after,
|
93
|
+
$args->after,
|
94
|
+
$title
|
95
|
+
);
|
96
|
+
return apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
97
|
+
}
|
98
|
+
}
|
99
|
+
```
|