This repository was archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsingle-tip.php
More file actions
86 lines (73 loc) · 2.71 KB
/
Copy pathsingle-tip.php
File metadata and controls
86 lines (73 loc) · 2.71 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
<?php get_header(); ?>
<div class="site-content">
<?php if ( have_posts() ) : ?>
<div class="row">
<div class="columns medium-9">
<?php while( have_posts() ) : the_post(); ?>
<header class="page-header">
<h2><?php the_title(); ?><?php edit_post_link( ' <small><i class="fa fa-pencil"></i></small>' ); ?></h2>
</header>
<div class="page-content">
<?php
$commands = get_posts( array(
'connected_type' => 'command_to_tip',
'connected_items' => get_the_ID(),
'post_type' => 'command',
) );
$matched_command = false;
foreach( $commands as $command ) : ?>
<div class="panel">
<p><a href="<?php echo get_permalink( $command->ID ); ?>"><strong>wp <?php echo apply_filters( 'the_title', $command->post_title ); ?></strong> - <?php echo $command->post_excerpt; ?></a></p>
</div>
<?php
$matched_command = $command->ID;
break;
endforeach; ?>
<?php the_content(); ?>
<div class="content-meta row">
<div class="columns small-8">
<?php echo runcommand::get_template_part( 'share-buttons', array(
'obj' => runcommand\Query::get_post_by_id( get_the_ID() ),
) ); ?>
</div>
<div class="columns small-4">
<div class="right"><em>Updated <?php the_modified_date(); ?></em></div>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<div class="columns medium-3 sidebar">
<?php
$commands = get_posts( array(
'post_type' => 'command',
'post_name__in' => array( 'profile', 'doctor' ),
) );
if ( ! empty( $commands ) ) : ?>
<h5>Premium Commands</h5>
<ul>
<?php foreach( $commands as $command ) : ?>
<li><a href="<?php echo get_permalink( $command->ID ); ?>"><?php echo apply_filters( 'the_title', $command->post_title ); ?></a> - <?php echo str_replace( array( '<p>', '</p>' ), '', apply_filters( 'the_excerpt', $command->post_excerpt ) ); ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php
$args = array( 'post_type' => 'tip' );
if ( $matched_command ) {
$args['connected_type'] = 'command_to_tip';
$args['connected_items'] = $matched_command;
}
$tips = get_posts( $args );
if ( ! empty( $tips ) ) : ?>
<h5><?php echo $matched_command ? 'Related ' : ''; ?>Excerpts</h5>
<ul>
<?php foreach( $tips as $tip ) : ?>
<li><a href="<?php echo get_permalink( $tip->ID ); ?>"><?php echo apply_filters( 'the_title', $tip->post_title ); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php get_footer(); ?>