|
1 <div class="wrap"> |
|
2 <h2>Timelines |
|
3 <a href="<?php echo admin_url( "admin.php?page=contenttimeline_edit" ); ?>" class="add-new-h2">Add New</a> |
|
4 </h2> |
|
5 <?php |
|
6 |
|
7 ?> |
|
8 |
|
9 |
|
10 <table class="wp-list-table widefat fixed"> |
|
11 <thead> |
|
12 <tr> |
|
13 <th width="5%">ID</th> |
|
14 <th width="30%">Name</th> |
|
15 <th width="60%">Shortcode</th> |
|
16 <th width="20%">Actions</th> |
|
17 </tr> |
|
18 </thead> |
|
19 |
|
20 <tfoot> |
|
21 <tr> |
|
22 <th>ID</th> |
|
23 <th>Name</th> |
|
24 <th>Shortcode</th> |
|
25 <th>Actions</th> |
|
26 </tr> |
|
27 </tfoot> |
|
28 |
|
29 <tbody> |
|
30 <?php |
|
31 global $wpdb; |
|
32 $prefix = $wpdb->base_prefix; |
|
33 |
|
34 if($_GET['action'] == 'delete') { |
|
35 $wpdb->query('DELETE FROM '. $prefix . 'ctimelines WHERE id = '.$_GET['id']); |
|
36 } |
|
37 $timelines = $wpdb->get_results("SELECT * FROM " . $prefix . "ctimelines ORDER BY id"); |
|
38 if (count($timelines) == 0) { |
|
39 echo '<tr>'. |
|
40 '<td colspan="100%">No timelines found.</td>'. |
|
41 '</tr>'; |
|
42 } else { |
|
43 $tname; |
|
44 foreach ($timelines as $timeline) { |
|
45 $tname = $timeline->name; |
|
46 if(!$tname) { |
|
47 $tname = 'Timeline #' . $timeline->id . ' (untitled)'; |
|
48 } |
|
49 echo '<tr>'. |
|
50 '<td>' . $timeline->id . '</td>'. |
|
51 '<td>' . '<a href="' . admin_url('admin.php?page=contenttimeline_edit&id=' . $timeline->id) . '" title="Edit">'.$tname.'</a>' . '</td>'. |
|
52 '<td> [content_timeline id="' . $timeline->id . '"]</td>' . |
|
53 '<td>' . '<a href="' . admin_url('admin.php?page=contenttimeline_edit&id=' . $timeline->id) . '" title="Edit this item">Edit</a> | '. |
|
54 '<a href="' . admin_url('admin.php?page=contenttimeline&action=delete&id=' . $timeline->id) . '" title="Delete this item" >Delete</a>'. |
|
55 '</td>'. |
|
56 '</tr>'; |
|
57 } |
|
58 } |
|
59 ?> |
|
60 |
|
61 </tbody> |
|
62 </table> |
|
63 <div style="margin-top:20px;"> |
|
64 |
|
65 <h2>Step by step:</h2> |
|
66 <ul> |
|
67 <li><h3>1. Click on "Add New button"</h3></li> |
|
68 <li><h3>2. Setup your timeline, and click Save</h3></li> |
|
69 <li><h3>3. Copy "shortcode" from table and use it in your post or page. (for adding timeline into .php parts of template use it like this "<?php do_shortcode([content_timeline id="X"]) ?>" where X is id of your timeline)</h3></li> |
|
70 |
|
71 </ul> |
|
72 </div> |
|
73 </div> |
|
74 <?php |
|
75 |
|
76 ?> |