/** * @name functions.php * @uses Functions for the iwy bootstrap3 theme * @author Joel Garcin * @copyright IwebYou * @package IwY Bootstrap * @version 3.2.3 */ add_action( 'after_setup_theme', 'my_child_theme_setup' ); function my_child_theme_setup() { load_child_theme_textdomain( 'child', get_stylesheet_directory() . '/languages' ); } remove_action( 'init', 'iwy_sidebar_class' ); function iwy_sidebar_class( $sidebar_name ) { global $sidebars_widgets; if ( isset($sidebars_widgets[$sidebar_name]) ) { $count = count($sidebars_widgets[$sidebar_name]); } else { $count = 0; } switch ( $count ) { case '1': $class = 'col-md-12'; break; case '2': $class = 'col-md-6 col-sm-6'; break; case '3': $class = 'col-md-4'; break; case '4': $class = 'col-md-3 col-xs-6'; break; case '6': $class = 'col-md-4 col-sm-6'; break; default: $class = 'col-md-12'; break; } return $class; } /** * Callback function to display galleries (in HTML5) * * @param string $content * @param array $attr * * @return string */ function iwy_post_gallery($content, $attr) { global $instance, $post; $instance ++; // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if (isset( $attr['orderby'] )) { $attr ['orderby'] = sanitize_sql_orderby( $attr ['orderby'] ); if (!$attr ['orderby']) unset( $attr['orderby'] ); } extract ( shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => 'gallery', 'itemtag' => 'figure', 'icontag' => 'div', 'captiontag' => 'figcaption', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'align' => '', 'link' => 'file' ), $attr ) ); $id = intval( $id ); if ('RAND' == $order) $orderby = 'none'; if ($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 = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ($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 ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if (empty( $attachments )) return; if (is_feed()) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n"; return $output; } $output = ''; $itemtag = tag_escape( $itemtag ); $captiontag = tag_escape( $captiontag ); $columns = intval ( min( array( 8, $columns ) ) ); $float = (is_rtl ()) ? 'right' : 'left'; $selector = "gallery-{$instance}"; $size_class = sanitize_html_class( $size ); $output .= "\n"; return '
'. $output .'
'; } add_filter('post_gallery','iwy_post_gallery', 10, 2 ); ?>
Warning: Cannot modify header information - headers already sent by (output started at /home/arkalomebp/www/wp-content/themes/iwy03-arkalome/functions.php:1) in /home/arkalomebp/www/wp-includes/pluggable.php on line 1177