Support

Account

Forum Replies Created

  • I tried to put it in gallery.php, and functions.php, but suppose problem might lie here

    <?php
    
    add_filter( 'post_gallery', 'authentic_post_gallery', 10, 3 );
    
    function authentic_post_gallery( $output = '', $atts, $instance ) {
    
      $post = get_post();
    
      $default = array(
        'id'         => $post ? $post->ID : 0,
        'order'      => 'ASC',
        'orderby'    => 'menu_order ID',
        'columns'    => 3,
        'size'       => 'thumbnail',
      );
    
      $atts = array_merge($default, $atts);
    
      $id = intval( $atts['id'] );
    
      if ( ! empty( $atts['include'] ) ) {
        $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
    
        $attachments = array();
        foreach ( $_attachments as $key => $val ) {
          $attachments[$val->ID] = $_attachments[$key];
        }
      } elseif ( ! empty( $atts['exclude'] ) ) {
        $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
      } else {
        $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
      }
    
      if ( empty( $attachments ) ) {
        return '';
      }
    
      $selector = "gallery-{$instance}";
    
      if (isset($atts['layout'])) {
    
        $layout = $atts['layout'];
  • Thank you for trying to help me. Acf/load_value filter looks like feasible option. Unfortunately I don’t understand php.

  • I understand that it takes 3 steps with your method when uploading images to a new post (or with mine suggested).

    But I need to fix few hundred old posts manually (asi I understood from reading through forum that there is no simple method to updating them).

    Multiplying that number by 6 hurts.

Viewing 3 posts - 1 through 3 (of 3 total)