• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » Wordpress » How to Show Picture Gallery Automatically in Wordpress Post

How to Show Picture Gallery Automatically in WordPress Post

By Sigit Prasetya Nugroho ∙ September 21, 2015 ∙ Wordpress ∙ Leave a Comment

Share : TwitterFacebookTelegramWhatsapp

Programming Tutorials – Creating an picture gallery is basic creating the wordpress wallpaper’s theme. Seegatesite article will share how to display the picture gallery automatically in wordpress posts. If you want to create a blog wallpapers and you need to display your images in a professional manner like the gallery look? Most people start looking for a WordPress plugin that will help them to create a gallery in WordPress, you actually don’t need a plugin for this if you know how.

Here is videos preview how picture gallery script is working properly

Table of Contents

  • 1  Here’s how to display the picture gallery on wordpress post automatically
    • 1.1 Thus article about How to Show Picture Gallery Automatically in WordPress Post, hope useful.

 Here’s how to display the picture gallery on wordpress post automatically

1. Create php file as gallery-show.php in your themes folder and copy this code below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php if (is_single() ){ global $post; if ($post->post_status == 'publish' ) {
$imageattach = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'exclude'     => get_post_thumbnail_id()
) );
 
if ( $imageattach ) { ?>
 
 
<h3 class="gallery-title">Gallery of  <?php the_title(); ?></h3>
 
 
 
 
<ul class="single-gallery">
<?php foreach ( $imageattach as $imageatt ) {
echo '
 
<li class="gallery-items">';
echo wp_get_attachment_link( $imageatt->ID, 'full', true );
echo '</li>
 
 
';
}?>
</ul>
 
 
<?php } } } ?>

Explanation :

- Here is Query to showing all of attachment image on wordpress post

1
2
3
4
5
6
$imageattach = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_parent' => $post->ID,
'exclude'     => get_post_thumbnail_id()
) );

2. Include these code below to the single.php file in your theme

1
<?php include('gallery-show.php'); ?>

3. Add this css script to beautify the look

1
2
3
4
5
h3.gallery-title{text-align:center;}
li.gallery-items{font-size:11px;line-height:16px;overflow:hidden;width:134px;min-height:100px;float:left;}
.single-gallery li.gallery-items{margin:0px 6px 6px 2px;}
.gallery-items img{border:1px solid #ccc;border-radius:4px;padding:2px;width:95% !important;height:80px !important;}
.gallery-items img:hover{box-shadow:0px 0px 3px #111;}

4. To run these script working properly, try use new post and then go to "add media", upload your images and dont include in the post (just upload from media in the post), because the picture gallery will show automatically into your wordpress post.

How to Show Picture Gallery Automatically in WordPress Post

Thus article about How to Show Picture Gallery Automatically in WordPress Post, hope useful.

Another WordPress Related Post :

  • How To Create The Fastest Social Share Button WordPress Without Plugin
  • Create WordPress Slider Without Javascript
  • The Point Responsive WordPress Theme For Blogging
  • The Doctors Free WordPress Responsive Theme For Medical
  • Develop Your Site With Start Blogging The Responsive WordPress Theme
  • Zerius Theme The Free WordPress Responsive Theme

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (7) Publisher Tips (5) react (3) Reactjs (7) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) widget (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2021 Seegatesite.com