-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponsive-barchart.php
More file actions
executable file
·97 lines (75 loc) · 2.26 KB
/
responsive-barchart.php
File metadata and controls
executable file
·97 lines (75 loc) · 2.26 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
88
89
90
91
92
93
94
95
<?php
/**
* Plugin Name: Responsive Bar Chart!
* Description: HTML Code.
* Author: Raymond Thompson.
* Version: 1.0.
* Author URI: http://www.raythompsonwebdev.co.uk.
*
* @package Responsive Bar Char
*/
/**
* Responsive Bar Chart Shortcode *
*
* @param array $atts array of values.
* @param string $src url for audio.
* @return mixed
*
*/
function raythompsonwebdev_plugin_enqueue_chart_style() {
wp_enqueue_style( 'raythompsonwebdev_plugin_chart_style', plugins_url('/css/responsive-barchart.css',__FILE__ ) );
wp_enqueue_script( 'raythompsonwebdev_plugin_chart_script', plugins_url('/js/responsive-barchart.js',__FILE__ ) );
}
add_action( 'wp_enqueue_scripts', 'raythompsonwebdev_plugin_enqueue_chart_style' );
function responsivechart_callback( $atts ) {
$raythompsonwebdev_plugin_chart_bars = '[
{
"id": "1",
"language":"HTML",
"datapercentage": "75",
"dataskill":"INTERMEDIATE"
}, {
"id": "2",
"language":"CSS",
"datapercentage": "75",
"dataskill":"INTERMEDIATE"
}, {
"id": "3",
"language":"JAVASCRIPT",
"datapercentage": "80",
"dataskill":"INTERMEDIATE"
}, {
"id": "4",
"language":"PHP",
"datapercentage": "80",
"dataskill":"INTERMEDIATE"
}, {
"id": "5",
"language":"MYSQL",
"datapercentage": "70",
"dataskill":"INTERMEDIATE"
}
]';
$raythompsonwebdev_plugin_bars = json_decode( $raythompsonwebdev_plugin_chart_bars, true );
ob_start();
?>
<section id="prof_cont">
<h1><?php esc_html_e( 'Coding Languages', 'raythompsonwebdev-com' ); ?></h1>
<article id="chart">
<ul id="bars">
<?php
foreach ( $raythompsonwebdev_plugin_bars as $raythompsonwebdev_plugin_bar ) :
?>
<li>
<div
data-percentage="<?php printf( '%s', esc_html( $raythompsonwebdev_plugin_bar['datapercentage'] ), 'raythompsonwebdev-com' ); ?>" class="bar" data-skill="<?php printf( '%s', esc_html( $raythompsonwebdev_plugin_bar['dataskill'] ), 'raythompsonwebdev-com' ); ?>" ></div>
<span><?php printf( '%s', esc_html( $raythompsonwebdev_plugin_bar['language'] ), 'raythompsonwebdev-com' ); ?></span>
</li>
<?php endforeach; ?>
</ul>
</article>
</section><!--end of prof cont-->
<?php
return ob_get_clean();
}
add_shortcode( 'responsivechart', 'responsivechart_callback' );