author | ymh <ymh.work@gmail.com> |
Wed, 04 Dec 2019 11:40:06 +0100 | |
changeset 0 | 505fe5249d9c |
permissions | -rw-r--r-- |
0
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
function bfa_hor_cats($sort_order = "ID", $order = "ASC", $levels = "", $titles = "No", $exclude = "") { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
// allow option "order" only if Plugin "My category Order" is activated: |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
if ( !function_exists('mycategoryorder') AND $sort_order == 'order' ) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
$sort_order = "ID"; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
$list_cat_string = wp_list_categories('orderby=' . $sort_order . '&order=' . $order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0'); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n<ul class='children'>/i","<li class=\"rMenu-expand \\1\n <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
$list_cat_string = preg_replace("/<li class=\"(.*?)\n\t\t\t\t\t\t\t\t\t<ul class='children'>/i","<li class=\"rMenu-expand \\1\n\t\t\t\t\t\t\t\t\t <ul class=\"rMenu-ver children\">",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
# Added in 3.2.1: Option to add Category Description to menu bar link text |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
global $bfa_ata; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
if ( $bfa_ata['add_descr_cat_menu_links'] == "Yes" ) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
$list_cat_string = preg_replace_callback("| title=\"(.*?)\">(.*?)</a>|","bfa_add_descr_cat_menu_links",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
if ( $titles == "No" ) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
$list_cat_string = preg_replace("/title=\"(.*?)\"/si","",$list_cat_string); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
return $list_cat_string; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
35 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
36 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
37 |
function bfa_add_descr_cat_menu_links($matches) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
38 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
39 |
global $bfa_ata; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
40 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
41 |
if ( strpos($matches[1],__('View all posts filed under', 'atahualpa')) !== FALSE ) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
42 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
43 |
if ( $bfa_ata['default_cat_descr_text'] != '' ) { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
44 |
$default_cat_descr = str_replace("%category%", $matches[2], $bfa_ata['default_cat_descr_text']); |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
45 |
return '>'.$matches[2].'<br /><span class="cat-descr">'.$default_cat_descr.'</span></a>'; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
46 |
} else { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
47 |
return '>'.$matches[2].'</a>'; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
48 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
49 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
50 |
} else { |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
51 |
return '>'.$matches[2].'<br /><span class="cat-descr">'.$matches[1].'</span></a>'; |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
52 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
53 |
|
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
54 |
} |
505fe5249d9c
add foundations for pharmakon (bedrock + deploy)
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
55 |
?> |