Posted by KaiseRCrazY on 14th November 2009
Show Post Attachments!
In WordPress you can add attachments to your posts. Your articles be more interesting and shareable. WordPress have attachment manager and you can manage your attachments wtih this manager. Also you can show your attachments with a template code. Let’s Begin…
Here is the code;
Just copy and paste this code to your theme’s single.php or what your theme use the file to show posts. After that attachments will be shown.
// place inside loop
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo apply_filters('the_title', $attachment->post_title);
the_attachment_link($attachment->ID, false);
}
}
That’s All. Have a nice day.
- Wordpress
Filed Under
-
Categories
Tags
phpmyadmin nickname returning custom field commenting revision post XHTML protect hyperlink newsletter SEO Widget style comments usage Twitter wordpress dashboard kaisercrazy moderate word count NeoEase source theme develop category_description google xml sitemaps protected subscribe colored tag cloud disable article numbers more link list category collection didim blog version wp-admin inline comments holiday comment form image upload wprecipes article changes Blogroll future posts chrome funcitons area schedule editor today response time elseif Wordpress search modify theme_location firewall archives.php spam free queries non-complex tooltip security hole Facebook wp_page_menu ads color button bio more 2009 spiders have_posts login name comment_cookie Google login form writer close jump link randomize posts WP robots me exploit scanner comments.php disable captions Premium themes year extra area highlight problem IE6 recent commen vectorss social bookmark iphone contact Tinymce reCAPTCHA link featured.php expration trick attachment post date short title Yahoo feed ns4 integrate java post_status solution request category social date search term menu .htaccess highlight searched text exploit search Serkan Algur ie8 bubletooltips sql injection mysql description ie theme db firefox social networks rss feed hotlinking old posts footer Functions scheduled header.php style.css new year visitors without plugin footer.php article title no-index recipe security scan sidebar hide content visitor plugin writer guest upgrade del.icio.us Platinum SEO Pack happy new year template hide featured Udegbunam WorPress furl widgetize search engine show rss wp_posts custom title query plugin thumbnail archive the_loop single.php css system health else date button browser detect comments.php hacks sliding title author 2010 image fallback_cp content easy life mood random post core file show mood edit private sidebar.php 15 days old doctype funciton share on facebook comment functions.php sor_column generator wp_categories_menu long titles function spam commets XHTML tags CMS reddit plugins PDF author name database delay time wp_nav_menu steal weekly sql code file tweet fetch feed sticky posts Settings blog security login panel compress customizable titles php archive template auto save disable caching html change theme dashboard site bandwith google docs post editor Wordpress social bar div post attachments wordpress forums crawl change magazin style comment list search terms if captions archives delay footer links first image function_exists tim thumb comment editing index.php theme edit wthout plugin message digg wordpress 3.0 feedburner WpFunc Joomla dropdown menu server Popular Posts Related posts day RSS safari page link change categories categories in two columns timestamp vuvuzela noindex command hacks time Turkey menu sistemi hidden file menu_order spped up your blog yoast manager searched text shortcode Loop remove menu zlib library remove get image body month links echo output blog stats post_type non-premium themes functioıns highliht single system archive.php Google adsense jquery tabs rewiew update comment number question menu area delicious contact form 7 user_login wp version breadcumbs first publish time buttons javascript tutorialRecent Comments
- John, sorr... »
- John on Catch the First Imagenevermind ... »
- John on Catch the First ImageWhere do y... »
- ok, thank ... »
Archives
Blogroll
Google Ads















Made by Symmetric Web
Distributed by Smashing Magazine
No comments yet!