Strip the folder path away from wp_get_attachment_url to show filename only
Try this: basename(get_post_meta( $attachmentImage->ID, ‘_wp_attached_file’, true));
Try this: basename(get_post_meta( $attachmentImage->ID, ‘_wp_attached_file’, true));
I like this idea from wprecipes.com. It is a very lightweight solution. add_shortcode( ‘note’, ‘sc_note’ ); function sc_note( $atts, $content = null ) { if ( current_user_can( ‘publish_posts’ ) ) return ‘<div class=”note”>’.$content.'</div>’; return ”; } It allows you to use the [note]…[/note] shortcode to enter private comments.
Your code and description seem to refer to the previous/next attachment navigation. That code is intended to display previous/next attachment navigation, and that’s exactly what it’s doing. If you want to display all attachments: Within the Post Content, use the shortcode Programmatically, in the template file, use e.g. get_posts(), combined with e.g. wp_get_attachment_image(): <?php global … Read more
After reading up on the Backbone.js documentation I found out it’s quite easy to manually add attachments by ID to the library of the media frame. You can just assign a reference to the library on the open event. Then create an instance of wp.media.attachment. Fetch it. And then call the add function on your … Read more
Go into your WordPress Dashboard > Settings > Media and then untick the option that says Organize my folders into Month and Year based folders This will make it look like: http://example.com/wp-content/uploads/imagename.jpg Then to take it further you need to update you config.php file and add in either this line: define( ‘UPLOADS’, ‘image/’.’files’ ); This … Read more
Don’t forget that attachments are just posts (though they are native posts and those tend to be a special case). Thus simply get_post() on attachment ID should get you typical post object for it. 🙂 Similarly all API functions that work on posts should work on attachments.
If you know how to find the posts, then we can use WP CLI to do a 2 step process. First, grab all the post IDs in those categories using wp post list E.g. posts=$(wp post list –field=”ID” –category__in=”1,2,etc”) wp post delete $posts –force Then we can plug the values in posts into wp post … Read more
You do not add image attachment to post. In WordPress image attachment is also post. See post types in Codex. what is usually called post on surface is technically post of post post type. image attachment is a post of attachment post type. So what you need to do is to create image attachment (using … Read more
WordPress supports several types of attachment templates. The function get_attachment_template in wp-includes/theme.php provides this support; it is called in wp-includes/template-redirect.php. If your theme includes attachment.php all of your attachments will be rendered with that template. If your theme also includes image.php then all of your images will use that template as long as they have … Read more
From what you’ve described, it sounds like the theme doesn’t have an attachment.php template to handling displaying the actual attachment page. You check on the attachment page, by going to Appearance->Editor, and checking for an attachment.php; however, I believe that answer is incorrect. WordPress should default to displaying the image on the normal blog index … Read more