forked from nmynarcik/darkfalluw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-spell.php
69 lines (64 loc) · 2.38 KB
/
single-spell.php
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
<?php get_header();
$slug = basename(get_permalink($post->ID));
?>
<article id="content" class="<?php echo $slug; ?>">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<div id="single-spell-details">
<div class="thumb">
<?php
if(has_post_thumbnail()){
$default_attr = array(
'alt' => trim(strip_tags( $post->post_title )),
'title' => trim(strip_tags( $post->post_title ))
);
echo get_the_post_thumbnail( $post->ID, array(100,100), $default_attr );
}else{
echo "<img src='" . get_template_directory_uri() . "/images/no-image.png' width='64' height='64' title='No Image' alt='No Image' />";
}
?>
</div>
<p class="descr">
<?php
echo the_title() . ' is part of the ';
$spellRole = strip_tags(get_post_meta($post->ID, '_spell_role',true));
$spellSchool = strip_tags(get_post_meta($post->ID, '_spell_school',true));
$roleArgs=array(
'name' => $spellRole,
'post_type' => 'role',
'post_status' => 'publish',
'numberposts' => 1
);
$rolePosts = get_posts($roleArgs);
if( $rolePosts ) {
echo '<a href=" ' . get_permalink( $rolePosts[0]->ID ) . ' ">' . get_the_post_thumbnail( $rolePosts[0]->ID, array(25,25)) . strtoupper($spellRole) . '</a> role in the ';
}else{
echo strtoupper($spellRole);
}
$schoolArgs=array(
'name' => $spellSchool,
'post_type' => 'school',
'post_status' => 'publish',
'numberposts' => 1
);
$schoolPosts = get_posts($schoolArgs);
if( $schoolPosts ) {
echo '<a href=" ' . get_permalink( $schoolPosts[0]->ID ) . ' ">' . get_the_post_thumbnail( $schoolPosts[0]->ID, array(25,25)) . strtoupper($spellSchool) . '</a> school.';
}else{
echo strtoupper($spellSchool);
}
?>
<br><br>
<?php echo strip_tags(get_post_meta($post->ID, '_spell_descr',true)); ?>
<?php if(get_post_meta($post->ID, '_item_cost', true) != '') { ?>
<span class="badge badge-inverse">
<img src="<?php echo get_template_directory_uri();?>/images/prowess_icon.png"/> <?php echo get_post_meta($post->ID, '_item_cost', true); ?>
</span>
<? } ?>
</p>
</div>
<?php comments_template('', true); ?>
<?php endwhile; endif; ?>
</article>
<?php get_sidebar(); ?>
<?php get_footer(); ?>