Consistent syntax formatting
This commit is contained in:
@@ -218,7 +218,7 @@ function roots_theme_activation_options_validate($input) {
|
|||||||
return apply_filters('roots_theme_activation_options_validate', $output, $input, $defaults);
|
return apply_filters('roots_theme_activation_options_validate', $output, $input, $defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
function roots_theme_activation_action(){
|
function roots_theme_activation_action() {
|
||||||
$roots_theme_activation_options = roots_get_theme_activation_options();
|
$roots_theme_activation_options = roots_get_theme_activation_options();
|
||||||
|
|
||||||
if ($roots_theme_activation_options['create_front_page']) {
|
if ($roots_theme_activation_options['create_front_page']) {
|
||||||
@@ -295,7 +295,7 @@ function roots_theme_activation_action(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($roots_theme_activation_options['add_pages_to_primary_navigation']){
|
if ($roots_theme_activation_options['add_pages_to_primary_navigation']) {
|
||||||
$roots_theme_activation_options['add_pages_to_primary_navigation'] = false;
|
$roots_theme_activation_options['add_pages_to_primary_navigation'] = false;
|
||||||
|
|
||||||
$primary_nav = wp_get_nav_menu_object('Primary Navigation');
|
$primary_nav = wp_get_nav_menu_object('Primary Navigation');
|
||||||
@@ -326,4 +326,4 @@ function roots_deactivation_action() {
|
|||||||
|
|
||||||
add_action('switch_theme', 'roots_deactivation_action');
|
add_action('switch_theme', 'roots_deactivation_action');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ $roots_options = roots_get_theme_options();
|
|||||||
// http://txfx.net/wordpress-plugins/nice-search/
|
// http://txfx.net/wordpress-plugins/nice-search/
|
||||||
function roots_nice_search_redirect() {
|
function roots_nice_search_redirect() {
|
||||||
if (is_search() && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === false && strpos($_SERVER['REQUEST_URI'], '/search/') === false) {
|
if (is_search() && strpos($_SERVER['REQUEST_URI'], '/wp-admin/') === false && strpos($_SERVER['REQUEST_URI'], '/search/') === false) {
|
||||||
wp_redirect(home_url('/search/' . str_replace(array(' ', '%20'), array('+', '+'), urlencode(get_query_var( 's' )))), 301);
|
wp_redirect(home_url('/search/' . str_replace(array(' ', '%20'), array('+', '+'), urlencode(get_query_var('s')))), 301);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,14 +208,16 @@ function roots_gallery_shortcode($attr) {
|
|||||||
|
|
||||||
// Allow plugins/themes to override the default gallery template.
|
// Allow plugins/themes to override the default gallery template.
|
||||||
$output = apply_filters('post_gallery', '', $attr);
|
$output = apply_filters('post_gallery', '', $attr);
|
||||||
if ( $output != '' )
|
if ($output != '') {
|
||||||
return $output;
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
|
// We're trusting author input, so let's at least make sure it looks like a valid orderby statement
|
||||||
if ( isset( $attr['orderby'] ) ) {
|
if (isset($attr['orderby'])) {
|
||||||
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
|
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
|
||||||
if ( !$attr['orderby'] )
|
if (!$attr['orderby']) {
|
||||||
unset( $attr['orderby'] );
|
unset($attr['orderby']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extract(shortcode_atts(array(
|
extract(shortcode_atts(array(
|
||||||
@@ -231,30 +233,32 @@ function roots_gallery_shortcode($attr) {
|
|||||||
), $attr));
|
), $attr));
|
||||||
|
|
||||||
$id = intval($id);
|
$id = intval($id);
|
||||||
if ( 'RAND' == $order )
|
if ('RAND' == $order) {
|
||||||
$orderby = 'none';
|
$orderby = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
if ( !empty($include) ) {
|
if (!empty($include)) {
|
||||||
$include = preg_replace( '/[^0-9,]+/', '', $include );
|
$include = preg_replace( '/[^0-9,]+/', '', $include );
|
||||||
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
||||||
|
|
||||||
$attachments = array();
|
$attachments = array();
|
||||||
foreach ( $_attachments as $key => $val ) {
|
foreach ($_attachments as $key => $val) {
|
||||||
$attachments[$val->ID] = $_attachments[$key];
|
$attachments[$val->ID] = $_attachments[$key];
|
||||||
}
|
}
|
||||||
} elseif ( !empty($exclude) ) {
|
} elseif (!empty($exclude)) {
|
||||||
$exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
|
$exclude = preg_replace('/[^0-9,]+/', '', $exclude);
|
||||||
$attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
$attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
|
||||||
} else {
|
} else {
|
||||||
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty($attachments) )
|
if (empty($attachments)) {
|
||||||
return '';
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_feed() ) {
|
if (is_feed()) {
|
||||||
$output = "\n";
|
$output = "\n";
|
||||||
foreach ( $attachments as $att_id => $attachment )
|
foreach ($attachments as $att_id => $attachment)
|
||||||
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
|
$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
@@ -267,14 +271,15 @@ function roots_gallery_shortcode($attr) {
|
|||||||
$selector = "gallery-{$instance}";
|
$selector = "gallery-{$instance}";
|
||||||
|
|
||||||
$gallery_style = $gallery_div = '';
|
$gallery_style = $gallery_div = '';
|
||||||
if ( apply_filters( 'use_default_gallery_style', true ) )
|
if (apply_filters('use_default_gallery_style', true)) {
|
||||||
$gallery_style = "";
|
$gallery_style = "";
|
||||||
$size_class = sanitize_html_class( $size );
|
}
|
||||||
|
$size_class = sanitize_html_class($size);
|
||||||
$gallery_div = "<section id='$selector' class='clearfix gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
|
$gallery_div = "<section id='$selector' class='clearfix gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
|
||||||
$output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
|
$output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div);
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $attachments as $id => $attachment ) {
|
foreach ($attachments as $id => $attachment) {
|
||||||
// make the gallery link to the file by default instead of the attachment
|
// make the gallery link to the file by default instead of the attachment
|
||||||
// thanks to Matt Price (countingrows.com)
|
// thanks to Matt Price (countingrows.com)
|
||||||
$link = isset($attr['link']) && $attr['link'] === 'attachment' ?
|
$link = isset($attr['link']) && $attr['link'] === 'attachment' ?
|
||||||
@@ -284,15 +289,16 @@ function roots_gallery_shortcode($attr) {
|
|||||||
<{$icontag} class=\"gallery-item\">
|
<{$icontag} class=\"gallery-item\">
|
||||||
$link
|
$link
|
||||||
";
|
";
|
||||||
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
if ($captiontag && trim($attachment->post_excerpt)) {
|
||||||
$output .= "
|
$output .= "
|
||||||
<{$captiontag} class=\"gallery-caption\">
|
<{$captiontag} class=\"gallery-caption\">
|
||||||
" . wptexturize($attachment->post_excerpt) . "
|
" . wptexturize($attachment->post_excerpt) . "
|
||||||
</{$captiontag}>";
|
</{$captiontag}>";
|
||||||
}
|
}
|
||||||
$output .= "</{$icontag}>";
|
$output .= "</{$icontag}>";
|
||||||
if ( $columns > 0 && ++$i % $columns == 0 )
|
if ($columns > 0 && ++$i % $columns == 0) {
|
||||||
$output .= '';
|
$output .= '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= "</section>\n";
|
$output .= "</section>\n";
|
||||||
@@ -422,11 +428,12 @@ add_filter('post_thumbnail_html', 'roots_remove_self_closing_tags');
|
|||||||
// you want to change this or remove it because it's used as the description in the RSS feed
|
// you want to change this or remove it because it's used as the description in the RSS feed
|
||||||
function roots_notice_tagline() {
|
function roots_notice_tagline() {
|
||||||
global $current_user;
|
global $current_user;
|
||||||
$user_id = $current_user->ID;
|
$user_id = $current_user->ID;
|
||||||
|
|
||||||
if (!get_user_meta($user_id, 'ignore_tagline_notice')) {
|
if (!get_user_meta($user_id, 'ignore_tagline_notice')) {
|
||||||
echo '<div class="error">';
|
echo '<div class="error">';
|
||||||
echo '<p>', sprintf(__('Please update your <a href="%s">site tagline</a> <a href="%s" style="float: right;">Hide Notice</a>', 'roots'), admin_url('options-general.php'), '?tagline_notice_ignore=0'), '</p>';
|
echo '<p>', sprintf(__('Please update your <a href="%s">site tagline</a> <a href="%s" style="float: right;">Hide Notice</a>', 'roots'), admin_url('options-general.php'), '?tagline_notice_ignore=0'), '</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,18 +480,22 @@ function roots_clean_style_tag($input) {
|
|||||||
|
|
||||||
function roots_body_class() {
|
function roots_body_class() {
|
||||||
$term = get_queried_object();
|
$term = get_queried_object();
|
||||||
if (is_single())
|
|
||||||
|
if (is_single()) {
|
||||||
$cat = get_the_category();
|
$cat = get_the_category();
|
||||||
if(!empty($cat))
|
}
|
||||||
|
|
||||||
|
if(!empty($cat)) {
|
||||||
return $cat[0]->slug;
|
return $cat[0]->slug;
|
||||||
elseif(isset($term->slug))
|
} elseif(isset($term->slug)) {
|
||||||
return $term->slug;
|
return $term->slug;
|
||||||
elseif(isset($term->page_name))
|
} elseif(isset($term->page_name)) {
|
||||||
return $term->page_name;
|
return $term->page_name;
|
||||||
elseif(isset($term->post_name))
|
} elseif(isset($term->post_name)) {
|
||||||
return $term->post_name;
|
return $term->post_name;
|
||||||
else
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first and last classes for widgets
|
// first and last classes for widgets
|
||||||
|
|||||||
Reference in New Issue
Block a user