-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_cat.php
executable file
·90 lines (64 loc) · 2.17 KB
/
script_cat.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
<?php
/*
Template Name: Script de creación de categorías para subscribe 2
*/
?>
<?php get_header() ?>
<div style="height:100px;"> </div>
<?php
$args = array(
'type' => 'post',
'child_of' => 14,
'parent' => '', // Provincias
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'category',
'pad_counts' => false );
$categories = get_categories( $args );
$args2 = array(
'type' => 'post',
'child_of' => 3,
'parent' => '', // Categorías artísticas
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'category',
'pad_counts' => false );
$categories2 = get_categories( $args2 );
$args_parent_categories = array(
'type' => 'post',
'child_of' => 0,
'parent' => '3', // Hijas de categorías artísticas, para filtrar
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'category',
'pad_counts' => false );
$parent_categories = get_categories( $args_parent_categories );
foreach ( $categories as $category ) {
echo $category->cat_name . '<br />';
foreach ( $categories2 as $category2 ) {
echo $category->cat_name;
foreach ( $parent_categories as $parent_category ) {
if ( $parent_category->cat_ID == $category2->category_parent ) {
echo ' > ' . $parent_category->cat_name;
}
}
echo ' > ' . $category2->cat_name . '<br />';
}
}
get_footer();
?>