-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathdelibera_rewrite_rules.php
84 lines (56 loc) · 2.21 KB
/
delibera_rewrite_rules.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
<?php
/**
* Define todas as regras de rewrite utilizadas pelo delibera
*/
// nova-pauta REWRITE: habilita a interface para criação de nova pauta pela interface pública
add_action('generate_rewrite_rules', 'delibera_nova_pauta_generate_rewrite_rules');
function delibera_nova_pauta_generate_rewrite_rules($wp_rewrite) {
$new_rules = array(
"nova-pauta/?$" => "index.php?&tpl=nova-pauta",
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
add_filter('query_vars', 'delibera_nova_pauta_query_vars');
function delibera_nova_pauta_query_vars($public_query_vars) {
$public_query_vars[] = "tpl";
return $public_query_vars;
}
add_action('template_redirect', 'delibera_nova_pauta_template_redirect_intercept');
function delibera_nova_pauta_template_redirect_intercept() {
global $wp_query, $wpdb;
$tpl = $wp_query->get('tpl');
if ($tpl && $tpl === 'nova-pauta') {
$options = delibera_get_config();
if(isset($options['criar_pauta_pelo_front_end']) && $options['criar_pauta_pelo_front_end'] == 'S'){
global $deliberaThemes;
include $deliberaThemes->themeFilePath('delibera_nova_pauta.php');
die;
}
}
}
// -------- FIM nova-pauta -------
// temas REWRITE: lista de temas disponíveis na consulta
add_action('generate_rewrite_rules', 'delibera_temas_generate_rewrite_rules');
function delibera_temas_generate_rewrite_rules($wp_rewrite) {
// Cat = 1 é um POG para o WordPress que essa é uma página de archive
$new_rules = array(
"temas/?$" => "index.php?&tpl=temas&cat=1",
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
add_filter('query_vars', 'delibera_temas_query_vars');
function delibera_temas_query_vars($public_query_vars) {
$public_query_vars[] = "tpl";
return $public_query_vars;
}
add_action('template_redirect', 'delibera_temas_template_redirect_intercept');
function delibera_temas_template_redirect_intercept() {
global $wp_query;
$tpl = $wp_query->get('tpl');
if ($tpl && $tpl === 'temas') {
global $deliberaThemes;
include $deliberaThemes->themeFilePath('delibera_temas.php');
die;
}
}
// ---------- FIM temas/ ---------------