Support » Plugins and Hacks » Get ID from "Page link to"

Get ID from "Page link to"

  • I know it works when you set for a new page and then it create a gallery inside that page. But what happend when the “Page link to” is already created?.

    I use the gallery shortocode with do_shortcode so then in the page or CPT is a metabox where I put the gallery id to relate, and I´m guessing, How can I get the ID selected in the gallery as a “Page link to”?, it´s possible?

    Thanx for any help or advice 🙂


Viewing 2 replies - 1 through 2 (of 2 total)
  • I create a new gallery template, inside my theme folder is the folder /nggallery/gallery-slide.php, here I create a link for the images using the ID of the “Page link to”
    <a href="<?php bloginfo('url'); ?>/?p=<?php echo $gallery->pageid ?>"> it works, but is not exaclty what I need.

    If you want all images link to the “Page link to”, but in my case is not. I use NGG Custom Fields Plugin, resolving the link and gallery like this:

    <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($gallery)) : ?>
    	<div id="hotel-slider">
    	<?php foreach ( $images as $image ) : ?>
    		<div data-caption="#htmlCaption-<?php echo $image->pid ?>">
    			<a href="<?php echo $image->ngg_custom_fields["Link"]; ?>">
    				<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->imageURL ?>" />
     	<?php endforeach; ?>
    	<?php foreach ( $images as $image ) : ?>
    		<div class="orbit-caption" id="htmlCaption-<?php echo $image->pid ?>">
    			<?php echo $image->alttext ?>
     	<?php endforeach; ?>
    <?php endif; ?>

    and I insert the gallery using the shortcode inside the theme code:

    <?php if ( get_post_meta( get_the_ID(), '_ola_hotel_gallery', true) ): ?>
    		<?php echo do_shortcode('[nggallery id='.get_post_meta( get_the_ID(), '_ola_hotel_gallery',true ).' template=slide]');?>
    <?php endif; ?>

    My PHP/MySQL skills are limited so I don´t know how to use <?php echo $gallery->pageid ?> outside the new NGG template file.

    the correct way to insert the “Page link to” url was
    <?php echo get_permalink($gallery->pageid); ?>

    But I´m keep searching how to take the ID inside of the do_shortcode 🙁

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get ID from "Page link to"’ is closed to new replies.