Nextgen gallery – úprava zobrazení galerie a alba
Pro jeden web jsem potřeboval, aby mi galerie zobrazila název a popisek nad fotkami – řešení jsem našel na http://stackoverflow.com/questions/9674669/plugin-wordpress-nextgen-gallery-how-to-show-the-gallery-description-in-nextg.
Pro NextGEN Gallery 1.9.13 můžete použít tento postup
V souboru /wp-content/plugins/nextgen-gallery/view/gallery.php jsem úplně nad text doplnil kód
<?php $album = nggdb::find_album( get_query_var('album') ); ?> |
Pak pod jsem doplnil toto:
<?php /** Prida Nazev Galerie pri nastavenem "Album nebude odkazovat na podstranku galerie. Galerie bude zobrazena na strance alba. " **/ ?> <strong><?php echo $gallery->title ?></strong><br /><?php echo $gallery->description ?> <?php /** Ukoncení skriptu **/ ?> |
Pro zaktualizovanou NextGEN Gallery by Photocrati 2.0.66.29 můžete použít tento postup z fóra wordpressu.
Za první DIV tag v index.php uloženém v /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails doplňte následující.
<?php /** Prida Nazev Galerie pri nastavenem "Album nebude odkazovat na podstranku galerie. Galerie bude zobrazena na strance alba. " **/ global $wpdb; $gal_id = $displayed_gallery->container_ids; $myrow = $wpdb->get_row("SELECT * FROM wp_ngg_gallery WHERE gid = $gal_id[0]"); echo '<h1 style="padding-bottom: 20px;">' . $myrow->title . '</h1>'; ?> |
Pak jsem potřeboval, aby se všechny galerie zobrazily na jedné stránce a rovnou se zobrazily tak jako jednotlivé galerie (v tomto případě i se změnou popsanou výše). Na http://wordpress.org/support/topic/plugin-nextgen-gallery-show-all-photos-from-album-in-one-page jsem našel toto řešení, které fungovalo, přesně tak jak jsem potřeboval. Obsah souboru /wp-content/plugins/nextgen-gallery/view/album-extend.php jsem vyměnil za tento.
<?php /** Template Page for the album overview (extended) Follow variables are useable : $album : Contain information about the album $galleries : Contain all galleries inside this album $pagination : Contain the pagination content You can check the content when you insert the tag <?php var_dump($variable) ?> If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?> **/ ?> <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($galleries)) : ?> <div class="ngg-albumoverview"> <!-- List of galleries --> <?php foreach ($galleries as $gallery){ echo do_shortcode("[nggallery id=".$gallery->gid."]"); } ?> <!-- Pagination --> <?php echo $pagination ?> </div> <?php endif; ?> |
V kategorii: Wordpress