-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
87 lines (83 loc) · 2.77 KB
/
Copy pathfunctions.php
File metadata and controls
87 lines (83 loc) · 2.77 KB
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
<?php
/**
* Enqueue the Dashicons script.
*/
add_action('wp_enqueue_scripts', 'load_dashicons_front_end');
function load_dashicons_front_end()
{
wp_enqueue_style('dashicons');
}
/**
* Enqueue the Styles.
*/
wp_enqueue_style('topic-map-style', get_theme_file_uri('/assets/css/topic-map.css'));
/**
* Enqueue the Scripts.
*/
wp_enqueue_script('topic-map-expand-toggle', get_theme_file_uri('/assets/js/topic-map.js'), array(
'jquery'
), '1.0', true);
/**
* Add Topic-Map.
*/
add_filter('discourse_replies_html', 'add_topic_map');
function add_topic_map($content)
{
$topic_map = '
<div class="topic-map">
<section class="map map-collapsed">
<nav class="buttons">
<button class="widget-button btn btn no-text btn-icon" id="toggle-expand">
<span id="arrow" class="dashicons dashicons-arrow-down-alt2"></span>
</button>
</nav>
<ul class="clearfix">
<li>
<h4>created</h4>
<div class="topic-map-post created-at">
<a class="trigger-user-card">
<img alt="" width="20" height="20" src="{post_created_user_avatar}" title="{post_created_user_username}" class="avatar">
</a>
<span class="relative-date">{post_created_relative_time}</span>
</div>
</li>
<li>
<div>
<h4>last reply</h4>
<div class="topic-map-post last-reply">
<a class="trigger-user-card">
<img alt="" width="20" height="20" src="{last_reply_user_avatar}" title="{last_reply_user_username}" class="avatar">
</a>
<span class="relative-date">{last_reply_relative_time}</span>
</div>
</div>
</li>
<li>
<span class="number">{replies_count}</span>
<h4>replies</h4>
</li>
<li class="secondary">
<span class="number">{participants_count}</span>
<h4>users</h4>
</li>
<li class="secondary">
<span class="number">{links_count}</span>
<h4>links</h4>
</li>
</ul>
</section>
<section class="map-expanded" id="map-expanded" style="display:none">
<div class="frequent-posters">
<span class="topic-map-span">Frequent Posters</span>
<p>{participants}</p>
</div>
<div class="popular-links">
<span class="topic-map-span">Popular Links</span>
<p class="popular-links-p">{popular_links}</p>
</div>
</section>
</div>
';
return $topic_map_styles . $topic_map . $content;
}
?>