Tag Info

New answers tagged

0

Even if you could write your own field code, you should be good to go with Advanced Custom Fields and the Gallery Field as it is easy to configure and well documented.


1

This is correct behavior, if your attachment doesn't actually have anything in post_content field (which is quite common). When post–centric templates run, prepend_attachment() is used as filter to "emulate" post content. This is not the case with template "intended" for attachments. If you look at template-loader.php: elseif ( is_attachment() ...


0

Ok, I found the answer (actually paid a programmer to do it) modify to /* Add the link to the array if there's an image and if $is_intermediate (4th array value) is true or full size. */ if ( !empty( $image ) && ( true == $image[3] || 'full' == $size ) ) $links[] = "<a class='image-size-link' href='/show-image.php?path={$image[0]}' ...


0

I took a quick peek at the other question referenced in other comments, and the gist of how you loop through attachments there meshes with what is shown in the wp_get_attachment_image documentation example. In a nutshell, any attachments on a particular post will reference that post by ID. In particular, it's crucial to understand that attachments are ...


0

The CSS selectors above didn't work for me; however, after inspecting the page I came up with this, which did work: function remove_edit_image_button() { ?> <style> .wp_attachment_image p .button { display:none; } </style> <?php } Could be due to another plugin I'm using, or a different WP ...


1

I just created a plugin because I had the same problem. You can download it from here: https://wordpress.org/plugins/delete-original-image/


2

That's a lot of unattached images. If you have couple of hundred images then you can delete them manually from media library. 1. Click 'Screen Options' at the top right and set 'Show on screen' to 200. 2. Click 'Apply'. 3. Click the checkbox just under 'Bulk Actions' to check all images on the page. 4. Select 'Delete Permanently' in the 'Bulk Actions' ...


0

Don't know if that will solve all your problems, but: Generally nicely formatted code is easier to debug. E.g. your code is missing the closing brace. Besides it is better to write if/else(if) statements with braces. Nice indentation helps too. I'd suggest reading the WordPress - PHP Coding Standards. Regarding your code: As noted at the wp_mail() codex ...


0

If I well understood the question you can set support for page-attributes when you register a CPT like this: add_action( 'init', 'register_products_post_type' ); function register_products_post_type() { $labels = array( 'name' => 'Products' ); $args = array( 'labels' => $labels, 'public' => true, ...


0

Try in this way and let me know if it works or not .. <?php $my_attachment = 2447; $image_url = wp_get_attachment_image_src( $my_attachment );?> <img src="<?php echo $image_url[0] ?>" /> ?>


1

There's a great PHP solution here which will add the gallery editor to the custom post type editor - great, if like me, you are creating custom post types using PHP and importing data using WPAllImport. In this case, I want to ensure I use the default gallery so I can allow my clients to edit/add/delete imported images. The code below adds the gallery ...


3

Try removing (image), like this: <?php $content = get_the_content(); $content = preg_replace("/<img[^>]+\>/i", " ", $content); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?>



Top 50 recent answers are included