-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
executable file
·78 lines (77 loc) · 2.9 KB
/
single.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
70
71
72
73
74
75
76
77
78
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if($post->post_type=='post'):?>
<div class="wrapper blog-list">
<h1><?php the_title();?></h1>
<div class="lcol">
<div class="meta">
<?php $categories1= get_the_category($post->ID);
foreach($categories1 as $cat_new) {?>
<a href="<?php echo site_url(); ?>/resources/topic/<?php echo $cat_new->slug;?>" class="category"><?php echo $cat_new->cat_name;?></a>
<?php } ?>
<span class="info"><?php echo get_the_date('F j, Y'); ?></span>
<a href="#commentsSection" class="comments"><?php comments_number( '0 Comments', '1 Comment', '% Comments' ); ?></a>
</div>
<?php the_content();?>
<div class="commentarea"><a name="commentsSection"></a><?php comments_template(); ?></div>
</div>
<div class="rcol">
<aside class="categories">
<section>
<h3>Topics</h3>
<ul class="list">
<?php
$table_name = "term_taxonomy"; // Assign the table name we wish to query
$table = $table_prefix . $table_name; // Put it all together
$queryresult = $wpdb->get_results("SELECT * FROM " . $table." WHERE parent='0' and taxonomy='category'");
foreach($queryresult as $result) {
$table_name1 = "terms"; // Assign the table name we wish to query
$table1 = $table_prefix . $table_name1; // Put it all together
$queryresult1 = $wpdb->get_results("SELECT * FROM " . $table1." WHERE term_id='".$result->term_id."'");
foreach($queryresult1 as $result1) {
if($result1->name=='Uncategorized') {
$result1->name='All';
}
if($category_id=='') {
$get_catid=1;
}
else {
$get_catid=$category_id;
}
if($result1->term_id!='' && $result1->term_id!=1) {
$my_query = new WP_Query( array(
'post_type'=>'post',
'cat'=>$result1->term_id,
'post_status'=>'publish'
));
}
else {
$my_query = new WP_Query( array(
'post_type'=>'post',
'post_status'=>'publish'
));
}
if($my_query->post_count>0) {
?>
<li <?php echo $result->term_id==$get_catid?'class="current"':'';?>><a href="<?php echo site_url(); ?>/resources/topic/<?php echo $result1->slug;?>" ><?php echo $result1->name;?></a></li>
<?php
}
}
}
?>
</ul>
<div class="arrow slide4"> </div>
</section>
</aside>
</div>
</div>
<?php else:?>
<div class="wrapper portfolio-item">
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<div class="commentarea"><a name="commentsSection"></a><?php comments_template(); ?></div>
</div>
<?php endif; endwhile; else: ?>
<p>Sorry, the page you are looking for has been moved or deleted.</p>
<?php endif; ?>
<?php get_footer(); ?>