/** * @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 .= "
    "; $i = 0; foreach ( $attachments as $id => $attachment ) { $comments = get_comments( array( 'post_id' => $id, 'count' => true, 'type' => 'comment', 'status' => 'approve' ) ); $link = wp_get_attachment_image( $id, $size, !(isset( $attr['link'] ) and 'file' == $attr['link']), array('class'=>'img-responsive aligncenter') ); if ( isset($attr['link']) ) { if ( $attr['link'] == 'none') { $link = $link; $modal = ''; } elseif ( $attr['link'] == 'file') { if ($captiontag and (0 < $comments or trim( $attachment->post_excerpt ))) { $comments = (0 < $comments) ? sprintf( _n('%d comment','%d comments', $comments, 'iwy'), $comments ) : ''; $excerpt = wptexturize (''. $attachment->post_excerpt .''); $out = ($comments and $excerpt) ? " $excerpt
    $comments " : " $excerpt$comments "; } else { $out = ''; } $link = '' . $link . ''; $modal = '

    '. get_the_title($id) .'

    '. wp_get_attachment_image( $id, 'large') .'

    '. $out .'
    '; } } else { $link = '' . $link . ''; $modal = ''; } $span = 'col-xs-6 col-sm-4 '. floor( 12 / $columns * 3 ) .' col-md-'. floor( 12 / $columns ); $output .= "
  • <{$itemtag} class=\"gallery-item img-thumbnail img-responsive\">"; $output .= "<{$icontag} class=\"gallery-icon\">{$link}\n"; if ($captiontag and (0 < $comments or trim ( $attachment->post_excerpt ))) { $comments = (0 < $comments) ? sprintf( _n ('%d comment','%d comments', $comments, 'iwy'), $comments ) : ''; $excerpt = wptexturize ( $attachment->post_excerpt ); $out = ($comments and $excerpt) ? " $excerpt
    $comments " : " $excerpt$comments "; $output .= "<{$captiontag} class=\"wp-caption-text gallery-caption\">{$out}\n"; } $output .= "{$modal}
  • \n"; } $output .= "
\n"; return '
'. $output .'
'; } add_filter('post_gallery','iwy_post_gallery', 10, 2 ); ?> twitter - Arkalome.fr
  • Es
  • Fr
  • En
Arkalome.fr

Arkalome.fr

Aller au contenu principal
Aller au contenu secondaire
  • Accueil
  • Nos missions
  • Moyens techniques
  • Références
  • Contact
Accueil » twitter
  • Image précédente
  • Image suivante

twitter

Publié le 19 septembre 2016 par Arnaud Gerbaud
twitter
  • Image précédente
  • Image suivante
  • Mentions Légales
  • Confidentialité
  • Contact

Arkalome

  • BP 60018 Cedex 01
    84201  Carpentras , Vaucluse , France
  • 06.95.19.94.08

Suivez-nous !

  • youtube
  • dailymotion
  • facebook
  • instagram
  • linkedin
  • viadeo
  • twitter
  • googleplus
Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site. Si vous continuez à utiliser ce dernier, nous considérerons que vous acceptez l'utilisation des cookies.OkEn savoir plus