I have a Image Gallery in NextGen and i want to show it on a page but problem is whenever i am loading image gallery with custom template it isn't loading here how is what i did, first i have a page homepage.php and at some place i added this code to show the gallery:
<?php
$NextG = new NextGEN_Shortcodes;
echo $NextG->show_gallery( array("id"=>1,"images"=>5,"template"=>"myshow") );
?>
my template file myshow.php contains this :
<ul id="slideshow">
<!-- Thumbnails -->
<?php foreach ( $images as $image ) : ?>
<li>
<?php if ( !$image->hidden ) { ?>
<img src="<?php echo $image->imageURL ?>" alt="<?php echo $image->alttext ?>" />
<?php } ?>
</li>
<?php endforeach; ?>
</ul>
Now Template file named myshow.php is located in wordpress\wp-content\themes\nggallery
and when i run the page it returns the images but it used default template what is wrong am i putting the wrong name??? am i putting the Template in wrong directory?? or is there something else ?
Ok i got the answer i only have to put right name prefix for my file "gallery-<mytemplatename>" so in above case it will be gallery-myshow.php
Related
I created a pop-up lightbox gallery in WordPress using Advanced Custom Fields and while all of the base functionality works, for some reason the lightbox appears to be showing all photos attached to the gallery_photos field across multiple posts instead of just the photos attached to the single post.
<?php
$images = get_field('gallery_photos');
if($images): ?>
<div class="gallery" id="post-gallery-<?php echo get_the_ID(); ?>">
<?php $i=0; foreach( $images as $image ) : ?>
<a href="<?php echo $image['url']; ?>" target="_blank" rel="lightbox" class="thumbnail">
<?php if( $i==0 ) : ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/camera-icon.png" width="30px" height="30px" alt="" border="0"/>
<?php endif; ?>
</a>
<?php $i++; endforeach; ?>
</div>
<?php endif; ?>
You can see a sample of how this is working at the following link to the dev site. There's a list of products, defined as a custom post type, and each product has an associated lightbox gallery of photos accessible via the camera icon at the end of each row.
However, if you click the icon you'll actually see photos for all products, not just the one you clicked. Any idea what I'm doing wrong?
I have ACF set up in WP with a Gallery field. Currently I am displaying my images as follows:
<p><?php echo get_the_content(); ?></p>
<?php $images = get_field('gallery_images');
if( $images ): ?>
<div>
<ul>
<?php foreach( $images as $image ): ?>
<li class="portrait float">
<img src="<?php echo $image['url']; ?>" />
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif;
?>
I have also installed the Simple Lightbox Plugin but have been unsuccessful so far. How do I add the URL link of my ACF Gallery images. I have tried wrapping my image tag in a link tag with rel="lightbox" and several other variations including:
<img rel="lightbox[gallery_images] src="<?php echo $image['url']; ?>" />
Is there any way I can enable Attachment Display Settings for my ACF Gallery images in my WP post. I think this might be handy to have?
Any help is much appreciated :)
I used the following which worked.
<img rel="lightbox[gallery_images]" src="<?php echo $image['url']; ?>" />
All my images are full size so didn't need the following at all:
echo $image_large[0];
as a newbie in wordpress i m searching over to create link of my 'new-category.php' file to display my product category only & 'category.php' will be default for others. So anyone please tell me how to change the default permalink to link-up my static 'new-category.php' file ?
Here below code displaying the default category page:
<?php $categories=getCategory ();
foreach ($categories as $category) { ?>
<li> <a href=" <?php echo get_category_link( $category->term_id );?>">
<?php echo $category->cat_name; ?> </a></li>
<?php } ?>
Create your page like :
<?php /* Template Name: my_category*/ ?>
<?php get_header(); ?>
//my_category page
<?php get_footer(); ?>
and access it like : http://yourdomain.com/my_category
Template Name: plays important role here.
I created a custom page template and put these "child page listing with thumbnail" code
footer not showing when I use this code.
<!------------------section-container------------------>
<div id="section-container">
<?php
$pages = get_pages('child_of='.$post->ID.'&parent='.$post->ID.'&sort_column
=menu_order&sort_order=asc');
foreach($pages as $page)
{ ?>
<div class="section-page">
<div class="section-thumb"><a href="<?php echo get_page_link($page->ID) ?>" title="
<?php echo $page->post_title ?>">
<?php echo get_the_post_thumbnail($page->ID, array(150,100)); ?></a>
</div>
</div><!--section-text-->
</div><!--section-page-->
<?php } ?>
</div>
<!------------------section-container------------------>
Example : http://www.behance.in/our-work/
Have you also included <?php get_footer(); ?> on your custom template?
Maybe you pasted over it when you included your custom code?
Wordpress templates need to explicitly call get_header, get_sidebar and get_footer if you want to include header.php, sidebar.php and footer.php.
I am trying to tweak NextGen Gallery plugin, and in particular the file nextgen-gallery/view/gallery.php to achieve displaying the gallery description, when I view the gallery.
So, in this file, I have added the following lines:
....
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
<?php if (!empty ($gallery)) : ?>
<?php /** Lots of stuff added here by Mpampirina **/ ?>
<p> You are here: <a class="Link" href="<?php echo get_permalink(); ?>">
<?php the_title(); ?></a> >
<?php $album = nggdb::find_album( get_query_var('album') ); ?>
<?php echo $album->name ?> > <?php echo $gallery->title ?>
</p>
<div class="ngg-description">
<p>Here I want to add the gallery description text. So I try with:
<?php echo $gallery->gallerydesc ?> . Also I try with:
<?php echo $gallery->galdesc ?> .
I get no description, whatsoever...
</p>
</div>
<?php /** End of stuff added by Mpampirina **/ ?>
<div class="ngg-galleryoverview" id="<?php echo $gallery->anchor ?>">
...
And here is the output:
The gallery description of course is not empty. There is text added, in the 'Manage Gallery" menu:
So, is there anybody who can see what I am doing wrong, or maybe point me to another question page that I might have missed? It would be very helpful! :-)
Thank you in advance
I just dealt with the same problem...
$gallery->description