PluginProbe
Tag Groups is the Advanced Way to Display Your Taxonomy Terms / trunk
Tag Groups is the Advanced Way to Display Your Taxonomy Terms vtrunk
2.2.2 2.2.1 2.2.0 trunk 1.40.0 1.40.2 1.41.0 1.42.1 1.43.0 1.43.1 1.43.10 1.43.10.1 1.43.2 1.43.3 1.43.4 1.43.5 1.43.6 1.43.7 1.43.9 1.44.0 1.44.1 1.44.3 1.44.3.1 2.0.0 2.0.1 All 36 releases
tag-groups / aliases.php

aliases.php in Tag Groups is the Advanced Way to Display Your Taxonomy Terms trunk, at aliases.php

88 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Tag Groups Pro
5 *
6 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
7 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
12 * THE SOFTWARE.
13 * @package Tag Groups Pro
14 *
15 * @author Christoph Amthor
16 * @copyright 2019 Christoph Amthor (@ Chatty Mango, chattymango.com)
17 * @license see official vendor website
18 *
19 * @since 1.19.0
20 */
21
22 /**
23 * Aliases for backwards compatibility and convenience
24 *
25 */
26 if (!function_exists('tag_groups_cloud') && class_exists('TagGroups_Shortcode_Tabs')) {
27 /**
28 *
29 * Wrapper for the static method tag_groups_cloud
30 *
31 * @param array $atts
32 * @param bool $return_array
33 * @return string
34 */
35 function tag_groups_cloud($atts = array(), $return_array = false)
36 {
37 return ( new TagGroups_Shortcode_Tabs() )->tag_groups_cloud($atts, $return_array);
38 }
39
40 }
41 if (!function_exists('tag_groups_accordion') && class_exists('TagGroups_Shortcode_Accordion')) {
42 /**
43 *
44 * Wrapper for the static method tag_groups_accordion
45 *
46 * @param array $atts
47 * @return string
48 */
49 function tag_groups_accordion($atts = array())
50 {
51 return ( new TagGroups_Shortcode_Accordion() )->tag_groups_accordion($atts);
52 }
53
54 }
55 if (!function_exists('post_in_tag_group')) {
56 /**
57 * Checks if the post with $post_id has a tag that is in the tag group with $tag_group_id.
58 *
59 * @param int $post_id
60 * @param int $tag_group_id
61 * @return boolean
62 */
63 function post_in_tag_group($post_id, $tag_group_id)
64 {
65 $tag_group_taxonomies = TagGroups_Taxonomy::get_enabled_taxonomies();
66 $tags = array();
67 foreach ($tag_group_taxonomies as $tag_group_taxonomy) {
68 $tags_tax = get_the_terms($post_id, $tag_group_taxonomy);
69
70 if (is_array($tags_tax)) {
71 $tags = array_merge($tags, $tags_tax);
72 } elseif (false === $tags_tax) {
73 return false;
74 }
75 }
76 if ($tags) {
77 foreach ($tags as $tag) {
78 $tg_term = new TagGroups_Term($tag);
79 if ($tg_term->has_group($tag_group_id)) {
80 return true;
81 }
82 }
83 }
84 return false;
85 }
86
87 }
88