Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Perry Johnson

    (@perry-johnson)

    I put that script in the bottom of the page. You could put it in a template or in the footer I suppose.

    Thread Starter Perry Johnson

    (@perry-johnson)

    Apparently this isn’t a bug in the plugin. Perhaps a problem with mediaelement.js? In any case, here’s how I fixed it. I’m open to a better solution though.

    <script>
    window.onpageshow = function(evt) {
        // If persisted then it is in the page cache, force a reload of the page.
        if (evt.persisted) {
            document.body.style.display = "none";
            location.reload();
        }
    };
    </script>

    I don’t know if you’re still looking for this solution but here’s what I’ve done:

    In my child theme’s functions.php

    /* For adding custom field to gallery popup */
    function pj_image_attachment_fields_to_edit($form_fields, $post) {
    	// $form_fields is a an array of fields to include in the attachment form
    	// $post is nothing but attachment record in the database
    	//     $post->post_type == 'attachment'
    	// attachments are considered as posts in WordPress. So value of post_type in wp_posts table will be attachment
    	// now add our custom field to the $form_fields array
    	// input type="text" name/id="attachments[$attachment->ID][custom1]"
    	$form_fields["pj-image-link"] = array(
    		"label" => __("Custom Link"),
    		"input" => "text", // this is default if "input" is omitted
    		"value" => get_post_meta($post->ID, "_pj-image-link", true),
                    "helps" => __("Shows below the description in galleries with 'see more'."),
    	);
       return $form_fields;
    }
    // now attach our function to the hook
    add_filter("attachment_fields_to_edit", "pj_image_attachment_fields_to_edit", null, 2);
    
    function pj_image_attachment_fields_to_save($post, $attachment) {
    	// $attachment part of the form $_POST ($_POST[attachments][postID])
            // $post['post_type'] == 'attachment'
    	if( isset($attachment['pj-image-link']) ){
    		// update_post_meta(postID, meta_key, meta_value);
    		update_post_meta($post['ID'], '_pj-image-link', $attachment['pj-image-link']);
    	}
    	return $post;
    }
    // now attach our function to the hook.
    add_filter("attachment_fields_to_save", "pj_image_attachment_fields_to_save", null , 2);

    This goes in gallery-to-slideshow-class.php where the caption html output is being constructed.

    $image_link = get_post_meta($attachment->ID, '_pj-image-link', true);	// Perry Johnson edit
                            $output .= '<p class="flex-caption"><span>' . esc_html( $attachment->post_excerpt );
                            if($attachment->post_content != ""){
                            	$output .= ' &mdash; '. $attachment->post_content;
                            }
                            $output .= '</span>';
                            if($image_link != ""){ // Perry Johnson edit
                            	$output .= '<a href="'.$image_link.'" class="slideInfoLink" title="See more details about this one.">➤</a>';
                            }

    I believe I had this issue of shrinking widget areas with the 1.7.5 upgrade. I tracked it down to a change in #widgets being display:inline-block in 1.7.5. I changed it back to block in my child theme and all is well.

    Emil, are you saying that we should be upgrading our Child theme as well? If so, there are a ton of changes I’ve made in my child theme that I’ll then have to migrate over to any newly updated Child theme. I don’t know if this makes any sense but there’s no concept of grandchild themes so here we are.

    Is there a way to stop auto play selectively, perhaps through a shortcode attribute? I’ve been probing around in the code for awhile with no success.

Viewing 5 replies - 1 through 5 (of 5 total)