Trying to get custom post type attachment images to function in indexed array

Managed to find a solution that display the array correctly: $attachments = get_children( array( ‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘numberposts’ => -1, ‘post_status’ => ‘inherit’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ASC’ ) ); $imgArray = array(); $counter = 0; foreach ( $attachments as $attachment_id => $attachment ) { $imgArray[$counter] = … Read more

Display images from JS?

You don’t specify how precisely your JS is output. If you are doing this inline from PHP you could just echo required data in place. If it’s just some arbitrary script, loaded as such, then the common practice in WP is to use wp_localize_script() to pass data from PHP runtime to an enqueued script. While … Read more

Only current gallery images with get_attached_media

Found an answer using Shortcode which helped: How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()? My working code now looks like this: // Extract the shortcode arguments from the $page or $post $shortcode_args = shortcode_parse_atts(get_match(‘/\[gallery\s(.*)\]/isU’, $post->post_content)); // get the ids specified in the shortcode call $ids = … Read more

Background image call problem

UPDATE: Added a third example to show you how to output the path inside a PHP string, per the source code you provided in the comments. There’s nothing wrong with having a full path in your CSS but you want to make sure the path is being dynamically generated by WordPress for the most consistent … Read more

Is possible to do this from function.php

I’m not sure why you cannot just create a child theme and then simply copy the single template to your child theme and remove the code, but anyways, this is still a very interesting approach. Regardless what have been said in comments using CSS to hide the thumbnail (which I do not support as it … Read more