WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: NextGen Gallery] Pagination and custom fields (5 posts)

  1. electriccupcake
    Member
    Posted 4 years ago #

    I'm using nextgen gallery for a new site I'm working on, and I want to have a custom field show up on the first page of the post but not the others. I've gotten it to work for a multiple-page post (yay!), but then I noticed that nextgen uses its own pagination, not WordPress's nextpage tag. Argh!

    Anyone have any ideas?

  2. electriccupcake
    Member
    Posted 4 years ago #

    I can clarify any of this if my question is unclear.

  3. electriccupcake
    Member
    Posted 4 years ago #

    Sorry to keep posting on this, but I've been working on it and would really be happy for any insight.

    With some help from some other posts here, I've added

    <?php
       $custom = get_post_meta($post->ID, custom, true);
       $page = (get_query_var('page')) ? get_query_var('page') : 1;
    
       if ($page == 1) { ?>
          <?php echo get_post_meta($post->ID, custom, true); ?>
       <?php } else { ?>
          <?php { echo ''; } ?>
    <?php } ?>

    to single.php in my template. Fantastic! I can get a custom field to appear on page one of my post, and not on any others.

    However, I want it just above a NextGen gallery, and that gallery will have many pictures, so I need it spread out on multiple pages. No problem, NextGen does that. However, it uses a different format for the page names (/page-2/ as opposed to /2/ when generated by WordPress, so my custom field shows up on every page of the post when the pages are generated by the gallery.

    I've tried $plugin_page as a variable to see if the page was generated by a plugin, and then post or not post the custom field accordingly, but it didn't work. Maybe my syntax was off? I've since changed the file, I don't have an example of what I tried.

  4. electriccupcake
    Member
    Posted 4 years ago #

    I've also tried to do the custom field, then a page break, and then start the gallery on page 2 of the post, but that didn't work, either (unsurprisingly). It all appeared on the same page.

  5. electriccupcake
    Member
    Posted 4 years ago #

    Well, I do feel stupid.

    This is why I'm looking for help!

    So the NextGen gallery actually formats the new page address as http://website/nggallery/post/postname/page-2

    Going to bed now, because I clearly need it having missed that.

    I am still, however, looking for a way to reference a new page in the code so I can specify what I want on each page of the post, if anyone could kindly share their ideas or insight.

Topic Closed

This topic has been closed to new replies.

About this Topic