Completed
Push — update/5.4-changelog ( eddd9e...9ff665 )
by Jeremy
11:34 queued 03:51
created

twentyten.php ➔ twenty_ten_has_footer_widgets()   B

Complexity

Conditions 5
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 4
nc 2
nop 1
dl 0
loc 6
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Infinite Scroll Theme Assets
4
 *
5
 * Register support for @Twenty Ten and enqueue relevant styles.
6
 */
7
8
/**
9
 * Add theme support for infinity scroll
10
 */
11
function twenty_ten_infinite_scroll_init() {
12
	add_theme_support( 'infinite-scroll', array(
13
		'container' => 'content',
14
		'render'    => 'twenty_ten_infinite_scroll_render',
15
		'footer'    => 'wrapper',
16
	) );
17
}
18
add_action( 'init', 'twenty_ten_infinite_scroll_init' );
19
20
/**
21
 * Set the code to be rendered on for calling posts,
22
 * hooked to template parts when possible.
23
 *
24
 * Note: must define a loop.
25
 */
26
function twenty_ten_infinite_scroll_render() {
27
	get_template_part( 'loop' );
28
}
29
30
/**
31
 * Enqueue CSS stylesheet with theme styles for infinity.
32
 */
33
function twenty_ten_infinite_scroll_enqueue_styles() {
34
	if ( wp_script_is( 'the-neverending-homepage' ) ) {
35
		// Add theme specific styles.
36
		wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
37
	}
38
}
39
add_action( 'wp_enqueue_scripts', 'twenty_ten_infinite_scroll_enqueue_styles', 25 );
40
41
/**
42
 * Do we have footer widgets?
43
 */
44
function twenty_ten_has_footer_widgets( $has_widgets ) {
45
	if ( is_active_sidebar( 'first-footer-widget-area' ) || is_active_sidebar( 'second-footer-widget-area' ) || is_active_sidebar( 'third-footer-widget-area'  ) || is_active_sidebar( 'fourth-footer-widget-area' ) )
46
		$has_widgets = true;
47
48
	return $has_widgets;
49
}
50
add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_ten_has_footer_widgets' );