Tag Info

New answers tagged

-3

How to create attachment to, http://domain.com/slug-parent_$id.html $id = attachment id


1

You are not providing a correct attachement ID. Replace: $image_alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true); With: $image_alt = get_post_meta( $image->id, '_wp_attachment_image_alt', true); Note: I assume that $image->id is correct because you use it later in your code and you get the expected result. Unfortunatley ...


1

You can try adding the input file field once and using then using jQuery to add more fields when clicking add more. Here are the steps Register your setting using register_setting function Create Menu using add_menu_page. This also requires a calback function Add the thickbox and media-upload script using wp_enqueue_script and wp_enqueue_style Use the ...


1

Actually I got to the bottom of it. The problem was that I have installed the WPML plugin. But I forgot to install the WPML Media plugin. As soon as I installed it, the attachment pages started working again. In my opinion, this is unacceptable and I will escalate the issue to WPML team. If the Media plugin is so critical, it should be made obvious to the ...


0

It sounds like a migration issue. This is worth checking: Did you replace the old website URL in all your database occurrences using a replacement tool like this? Is the .htaccess on your web server updated with the right path and permalink rewriting rules? (Saving again your permalink preferences should do the trick.)


0

If you look at the raw post data... while (have_posts() ) { the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>><?php var_dump($post); ?> </article><?php } You will see that there is nothing in there to specify "medium", so I went looking. There is a filter on the_content... ...


0

You can customize the wp_get_attachment_image function as per your need. pass the image size you want to display. wp_get_attachment_image( $attachment->ID, 'full' ); more info at: https://codex.wordpress.org/Function_Reference/wp_get_attachment_image


0

You should be able to set your own image tag. You can replace the_content(); with this. <img src="<?= wp_get_attachment_url(get_the_ID()); ?>"/>


1

You've probably solved this, but for anyone else that needs this: $wp_taxonomies['category']->update_count_callback = '_update_generic_term_count'; This is significant in the case of attachments. Because an attachment is a type of post, the default _update_post_term_count() will be used. However, this may be undesirable, because this will only ...



Top 50 recent answers are included