Forum Replies Created

Viewing 15 replies - 106 through 120 (of 193 total)
  • Plugin Author Andy Mercer

    (@kelderic)

    I don’t think you are understanding me. When you create or edit a gallery, the images are placed into the metabox. It requires the JS change to change that. Changing the PHP won’t affect it.

    Plugin Author Andy Mercer

    (@kelderic)

    Images are loaded in 2 ways. The first is during page load. Images are called via PHP. Your proposed change would affect that. The second is from JS, using Backbone. This is what happens when you select images from the media manager. When you are creating a gallery for the first time, or editing an existing one. Your change wouldn’t affect that.

    Plugin Author Andy Mercer

    (@kelderic)

    I’ve been looking into the image size. I’d like to just provide a filter, the way that post types have one. However, the images are placed into the HTML via Backbone.js, which powers the media manager. Right now I’m using:

    imageHTML += '<li>'+button+'<img id="'+attachment.attributes.id+'" src="'+attachment.attributes.url+'"></li>';

    The attachment.attributes.url is what returns the URL, but it’s the full URL, and I’m not sure how to get the other sizes. If you are familiar with the Backbone implementation that WP uses, I’d love to get your input.

    Plugin Author Andy Mercer

    (@kelderic)

    Do you have the widget placed in the side or main area of the page?

    For reordering, you use the built in WP reorder screen that appears after you select the images. Drag and drop.

    Plugin Author Andy Mercer

    (@kelderic)

    I gave my two weeks notice last Friday, so in a very short time, I will have a lot of time to dive into a few of these tricky questions.

    Plugin Author Andy Mercer

    (@kelderic)

    The reason it is adding to a PPH variable is because it’s in a function which is called from the theme.

    Plugin Author Andy Mercer

    (@kelderic)

    Okay, the first thing you have to do it create the HTML/CSS/JS gallery structure, using filler images. For what you describe, I would typically go with a wrapper parent, then a bunch of img elements, or a bunch of divs with inline style setting background-image.

    Once your gallery is up and running, you can start getting real images from Featured Galleries.

    I’ll show you an example structure (that I created to use on this page: https://www.rmasurveying.com/services/featured-projects/walnut-commons/?d=198 ), and then walk you through the Featured Galleries PHP code that went into the PHP template.

    div class="galleryframe">
        <img style="background-image:url();>
        <img style="background-image:url();>
        <img style="background-image:url();>
        <img style="background-image:url();>
        <button class="arrow left"></button>
        <button class="arrow right"></button>
        <button class="nav selected"></button>
        <button class="nav"></button>
        <button class="nav"></button>
        <button class="nav"></button>
      </div>

    The PHP:

    $galleryArray = get_post_gallery_ids(get_the_ID());
    $y = count($galleryArray);
    
        $returnedContent .= '<div class="galleryframe" data-selected="1" data-total="'.$y.'">';
    
            foreach ($galleryArray as $imageID) { $imageArray = wp_get_attachment_image_src( $imageID, 'large', 0 );
    
                $returnedContent .= '<img style="background-image:url('.$imageArray[0].'); z-index:'.$y.'" data-order="'.$z.'">';
    
            $z++; $y--;}
    
            if ($z > 2) {
    
                $returnedContent .= '<button class="arrow left">?</button>';
    
                $returnedContent .= '<button class="arrow right">?</button>';
    
                foreach ($galleryArray as $imageID) { $y++;
    
                    $returnedContent .= '<button class="nav'.($y==1 ? ' selected' : '').'" data-image="'.$y.'"></button>';
    
                }
    
            }
    
        $returnedContent .= '</div>';
    Plugin Author Andy Mercer

    (@kelderic)

    To make sure I understand what you want to do, from reading the above, you want to change the main index.php template (which shows the list of blog posts) so that instead of showing one image, it shows a gallery, correct?

    Are you shooting for something where there is the one image, and it changes on a timer? Or with arrows floating? If you can provide more details I can see about working something up.

    Please note, for anything other than a static gallery (grid of thumbnails), you’ll need JS, and a bunch of CSS.

    Plugin Author Andy Mercer

    (@kelderic)

    When you set the value of $ids, using the function you mentioned about, you are setting it to an array of numbers. These numbers are the id numbers of the images that make up the gallery. You still have to create an image out of them. This is done using a loop.

    Have you read the examples? The very first example code is quite literally exactly what you are trying to do.

    Plugin Author Andy Mercer

    (@kelderic)

    Cheers for writing all this. I don’t have time to examine now, but this weekend or next week by absolute latest I will and likely will incorporate it into the guide.

    Plugin Author Andy Mercer

    (@kelderic)

    Thank you for your review, yutonet, and for the support, ninjaskor. I have a list of things to address, including the side of the images in the backend. My real-life job has been about 12 hours a day for the past 2 weeks though; I haven’t had a chance. Next week I think things are going to calm down and I can really dive into some of these issues.

    Plugin Author Andy Mercer

    (@kelderic)

    Thanks for looking those up, klihelp! I’ll try to dive into their code sometime this week to figure out how they are placing their options there.

    Plugin Author Andy Mercer

    (@kelderic)

    I’ll look into switching over. I need to overhaul the css that controls it anywhere. Weird proportions can cause it to look odd.

    Plugin Author Andy Mercer

    (@kelderic)

    1. I’ll look into it, see what’s going on.
    2. It’s a design decision, and I can understand there are other opinions. Problem is, I don’t want to create a full settings page just for one option. I think the best idea would be to put an option under the main Media Settings page, of, do you want to see the sidebar for featured galleries media popup. Just a checkbox, single option. I don’t know how to edit a core options page from a plugin though.

    Plugin Author Andy Mercer

    (@kelderic)

    Yes, as klihelp mentioned, get_post_gallery_ids() returns an array or a comma delimited string of image IDs. You’ll need to use a loop to display all of them.

Viewing 15 replies - 106 through 120 (of 193 total)