Tag Info

New answers tagged

1

You have two issues here. The use of $image->ID in this line wp_get_attachment_image($image->ID, 'video-thumb'); This will give you the following error: NOTICE Error: [8] Undefined variable: image In all honesty, I think that should actually be $post->ID get_permalink() returns the permalink to the current post, which in this case ...


1

Here's how to check if the post has an attachment other than image (or other mime types): <?php $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_parent' => $post->ID, 'exclude' => 'image' )); if ( $attachments ) { ?> ...


3

You can use the following within a loop: $files = get_attached_media( $type, $post_id ); Just define the attachment MIME type on $type. Second parameter is optional. Example from the Codex page: $media = get_attached_media( 'audio', 102 ); With the retrieved array, you can do something like: if( $media ) { //Show the post attachments that are not ...


1

You are using the size parameter of wp_get_attachment_image_src in a wrong format. This parameter can be: A string: keyword of the image size; thumbnail, medium, large, full or any other custom size previously registered). A 2-items array representing the width and height; for example, array( 100, 100 ). So, you have to change this: $thumb = ...


-1

Why not just use Gravity Forms with ACF. It does exactly what you're suggesting -- and I've used it a number of times on client sites with great success.


0

If all you do is update ACF fields with your form, why not use the built-in function to generate the form? Create a new ACF field for the images, or simply use the Gallery field type, then display the form using acf_form: <?php acf_form(array( 'post_id' => 'new_post', 'new_post' => array( 'post_type' => 'vendre', ...



Top 50 recent answers are included