-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebar.php
More file actions
62 lines (57 loc) · 1.99 KB
/
sidebar.php
File metadata and controls
62 lines (57 loc) · 1.99 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
<?php
/*
* sidebar.php
*
* @package Fluidity
* @subpackage Sidebar
* @since 20150511
* @author Richard Coffee <richard.coffee@rtcenterprises.net>
* @copyright Copyright (c) 2018, Richard Coffee
* @link https://github.com/RichardCoffee/fluidity-theme/blob/master/sidebar.php
*/
defined( 'ABSPATH' ) || exit;
who_am_i();
$loaded = false;
$called = fluidity_sidebar_parameter();
if (substr($called,0,6)==='footer') {
$loaded = fluidity_load_sidebar($called,true);
} elseif (is_front_page()) { # Alternate: ($wp_query->get('page_id')===get_option('page_on_front'))
$loaded = fluidity_load_sidebar('front');
} else {
$loaded = fluidity_load_sidebar($called);
}
if (!$loaded) {
global $wp_query;
$post_type = $wp_query->get('post_type');
$slug = ( $format=get_post_format() ) ? $format : get_post_type(); // inside loop only, which this is not
/*fluid()->log(
' called: ' . $called,
' post_type: ' . $post_type,
' page slug: ' . get_page_slug(),
"slug for sidebar: $slug"
); //*/
if ($post_type) {
if (!is_string($post_type)) {
$use_this = 'standard';
foreach($post_type as $type) {
if (in_array($type,array('post'))) { continue; }
$use_this = $type;
}
$post_type = $use_this;
#fluid()->log("FIXME: convert array to usable string",$post_type);
}
$loaded = fluidity_load_sidebar(array($post_type,$post_type.'_sidebar'));
}
}
/* Note: http://www.wpaustralia.org/wordpress-forums/topic/pre_get_posts-and-is_front_page/
global $wp;
if ( !is_admin() && $query->is_main_query() ) {
if ( is_home() && empty( $wp->query_string ) ) {
echo 'This displays when set to Your Latest Posts and the homepage is showing';
}
elseif ( ( $query->get( 'page_id' ) == get_option( 'page_on_front' ) && get_option( 'page_on_front' ) ) || empty( $wp->query_string ) ) {
echo 'This displays when set to A Static Page and the homepage is showing.';
echo 'It also displays for homepages with multiple pages (eg. http://sitename/page/2/)';
}
} //*/
?>