The attachment.php
is a specific template in the WordPress template hierarchy. WordPress uses it for a specific purpose, and the default Loop just won’t do what you’re claiming it’s doing. (The behavior you’re describing would be analogous to the single.php
template file looping through all Posts.)
I’m guessing your attachment.php
template file has a custom Loop. As Baiternet asked above, can you post or link the markup of your attachment.php
template file?
Related Posts:
- How to redirect to post if search results only returns one post
- remove links from images using functions.php
- How to override admin-bar style
- How to add classes to images based on their categories?
- wp_get_attachment_image returns different image size
- Passing variables to templates (alternatives to globalizing variables)
- Load post with a different template?
- How to customize search result page title?
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- How to fix a theme with page.php Default Template that accidentally deleted?
- WordPress Change Post Templates,but not drop down, but Image selection
- How to add a rel attribute to images that contains their categories?
- Using locate-template & shortcodes doesn’t appear to work
- Can I use require() function in a template file?
- How to set global variables in template page?
- Why isn’t is_page_template() adding a body class?
- Dequeue script in template isn’t working
- Query children and parent title
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- Adjust which tempalte a page uses with a function?
- Best way to programatically add “rel” attributes to page and post images
- How to change menu icon which is overriden (i.e. by WooCommerce) [closed]
- What is the “icon” parameter in wp_get_attachment_image_src used for?
- Make “sidebar template” the default template for new pages
- Retrieve post modified date for specific post by post ID
- Find first image on paginated post for Pinterest
- Attach parent category template to all subcategories
- Add class or ID to any WordPress function
- How to remove howdy dropdown menu content
- How to include local menu based on page id?
- How to create function from code?
- Display Password Protected external RSS in wordpress template
- How to extract the variables out from “add_shortcode” function?
- How do I permanently Disable Attachment Post URL
- Default Gallery Edit/Template Editable?
- How to enable template page only for a post id page
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- Selective Product Category for Carousel
- How to change login labels
- Modify a function without editing template
- Retrieve tags data in post body
- Image rotation fails to regenerate custom sized thumbnail
- Display images that are not in the content
- Functions For Calling Specific Elements
- Full page template function
- Can’t filter wp_get_attachment_link
- Get ID of first image attached to a post
- How to stop wordpress from injecting hard-coded style into image attachments with captions
- wordpress use single ajax in place of multiple ajax requests in a smarter way
- Add Element as a Filter to the_content
- I have problems with loading javascripts
- Pass variable from action back to template
- Need print logo without any ID & class
- Define PHP variable from a seperate API if statement
- How to hide image-url if no attachment?
- Best way to handle lack of titles in microblogging
- Run a jquery script on on a certain template page
- How to get an attachment id from a filename
- What are the meta fields for an attachment?
- How to include any template using Shortcode fuction?
- Image loading function not working on archive.php template
- Add a field into a shortcode of an extension
- Specify multiple categories for custom post template – FATAL ERROR
- Using functions.php to include code that’s processed inline
- How to make a new function that includes a template
- Remove attachment page for audio media type only
- Get Attachment Category Name
- Show admin page, only if function is being used
- Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy
- Prevent creating multiple image resizes in twentytwelve template
- How d0 i get the number of attachments in the post
- Simplest Way to Build Custom Archives Page?
- Display ACF category image on archive and single template files
- Different image using srcset function
- Render page with specific id from functions.php
- How to require a config file in a template and in function.php?
- the_date() and the_time() functions display actual date an time instead of published date and time
- Load templates, pass arguments, and render output from functions.php
- Auto delete content in specific folder inside media library
- Changing the HTML of notices in WooCommerce [closed]
- WP_Query for Attachments not working as expected
- How to update an image attachment’s alt text from a custom field when saving a post?
- WP Enqueue Script Error
- Remove all video attachment, both files and post/postmeta from database?
- More than one search results page template for two searches on site
- WordPress function with attribute pass to template
- Javascript and Stylesheet in child page
- Newest comments first not working
- Retrieve a custom form field modified by a filter
- How to pass a variable from a template page to the child theme functions.php
- Function the_content
- Open image size links in a page instead of direct image link
- Allow the access over wp-login.php
- Set thumbnail from URL, by grabbing image in functions.php
- Shortcode to output get_header not working
- Which template file to edit to edit homepage in Mystile [closed]
- Creating mixture of shortcodes to use in the visual/text editor
- My website is generating weired url parameters of paginated pages
- How to store page-{id}.php templates in custom folder
- Disable Attachment Page Except for Category