WordPress.org

Support

Support » How-To and Troubleshooting » [Plugin: NextGEN Gallery] Is it possible to show gallery title on gallery page?

[Plugin: NextGEN Gallery] Is it possible to show gallery title on gallery page?

  • Hello,

    is it possible to show the gallery title on the gallery pages (the page where the picture thumbnails are shown)?

    Kindest regards,
    Martin

Viewing 6 replies - 1 through 6 (of 6 total)
  • Add the following to the gallery.php page:

    <?php
    if($_GET['nggpage'] == "")
    {
    	   echo $gallery->title;
    }
    ?>

    /EDIT: Works… 😉

    How about adding this to the plugin core? It’s a nice thing. Maybe with an option “show title” or “do not show title”?

    Kindest regards,
    Martin

    Update: It still works, but shows the title also when inserting the gallery into a news post for example. Can I somehow define that the title is not shown in news and pages?

    Thank you for your reply. It is strange that the above code is also showing the title even if the gallery is embedded into a blog post:

    if ($_GET[‘nggpage’] == “”) { echo “<h2>”.$gallery->title.”</h2>”; }

    I changed the code to this:

    if (($_GET[‘nggpage’] == “”) && (is_page())) { echo “<h2>”.$gallery->title.”</h2>”; }

    Now there is no title shown, not on the gallery pages and not in the blog posts…

    Hmmm….?

    What I have done (for better or worse), is add this to the top of my gallery.php:

    <a href="http://www.yoursite.com/photos/">&larr; Back To All Photo Galleries</a>

    where photos is a WP slug for my main photos page and contains [album=# template=compact]

    When I make a gallery, in this example I made one called HDR, I make a new page, permalink of http://www.yoursite.com/photos/hdr/ and make its parent to be the Photos page and its content is [album=2,compact].

    I found some code at the codex site for checking for sub-pages (the following is in my WP functions.php:)

    function is_tree($pid) {     // $pid = The ID of the page we're looking for pages underneath
        global $post;           // load details about this page
        if(is_page()&&($post->post_parent==$pid||is_page($pid)))
            return true;        // we're at the page or at a sub page
        else
            return false;       // we're elsewhere
    };

    and put this in my WP post.php:

    <?php if (!is_tree(435)) : ?>
        <p class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a><?php edit_post_link(' (Edit)'); ?></p>
    <?php endif; ?>

    Every new photo gallery page I make, I ensure it is a child of the photo page.

    I know it has nothing to do at all with your question but I use it to see if a sub-page of my gallery is being called and if it is to basically not display the normal WP post title/date stuff but with subpages and this code you could easily determine if it is gallery page or not and if so to insert the required Gallery title.

    There isn’t really a good way to see what I just typed so I don’t know if it will come across all right…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: NextGEN Gallery] Is it possible to show gallery title on gallery page?’ is closed to new replies.
Skip to toolbar