WordPress.org

Forums

How do i add pagination to my website? (2 posts)

  1. Evolutionsic
    Member
    Posted 2 years ago #

    I want to add pagination to the bottom of my website, but rather instead of clicking, i want it to autoload more photos, the front page is just a page set in reading/static page

    website url : http://www.psd-locker.com please help!

    Merry Christmas :)

  2. Evolutionsic
    Member
    Posted 2 years ago #

    I think this is the single-gallery.php i don't know if it uses this page or page.php

    ?php
    /**
     * @package WordPress
     * @subpackage WPEX WordPress Framework
     */
    
    //get header
    get_header();
    
    //start post loop
    if (have_posts()) : while (have_posts()) : the_post();
    ?>
    
    <article id="post" class="single-gallery"> 
    
    	<div class="container clearfix">
    
            <div id="single-gallery-media">
                <?php
                //get attachement count
                $get_attachments = get_children( array( 'post_parent' => $post->ID ) );
                $attachments_count = count( $get_attachments );
    
                //show featured image if atachment count is equal to 1
                if($attachments_count <= '1') {	
    
                    //get featured image url
                    $thumb = get_post_thumbnail_id();
                    $img_url = wp_get_attachment_url($thumb,'full'); //get full URL to image
    
    				//crop value from admin panel
    				$height = of_get_option('gallery_post_img_height','450');
    				$hard_crop = ($height !='9999') ? true : false;
    
                    //resize & crop the featured image
                    $featured_image = $featured_image = aq_resize( $img_url, 720, $height, $hard_crop );
    
                    //show featured image if defined
                    if($featured_image) {
                    ?>
    
                        <div class="post-thumbnail">
                            <a href="<?php echo $img_url; ?>" title="<?php _e('Zoom Image','wpex'); ?>" class="prettyphoto-link"><img src="<?php echo $featured_image; ?>" alt="<?php echo the_title(); ?>" /></a>
                        </div><!-- /post-thumbnail -->
                    <?php } //no featured image ?>
                <?php }
                //attachment count greater then 1, load slider
                else {
                    //attachement loop
                    $args = array(
                        'orderby' => 'menu_order',
                        'post_type' => 'attachment',
                        'post_parent' => get_the_ID(),
                        'post_mime_type' => 'image',
                        'post_status' => null,
                        'posts_per_page' => -1
                    );
                    $attachments = get_posts($args);
                    ?>
    
                    <div class="flexslider-container">
                        <div id="slider-<?php $post->ID; ?>" class="flexslider flexslider-gallery">
                            <ul class="slides">
    
                                <?php
                                //loop through attachments
                                foreach ($attachments as $attachment) :
    
                                //get atachment url
                                $img_url = wp_get_attachment_url($attachment->ID,'full'); //get full URL to image
    
    							//crop value from admin panel
    							$height = of_get_option('gallery_post_img_height','450');
    							$hard_crop = ($height !='9999') ? true : false;
    
    							//resize & crop the featured image
    							$featured_image = $featured_image = aq_resize( $img_url, 720, $height, $hard_crop );
    
                                //include image in slider/gallery
                                $be_rotator_include = get_post_meta($attachment->ID, 'be_rotator_include', true);
                                if($be_rotator_include != '1') {
    
                                //get caption
                                $attachment_caption = $attachment->post_excerpt;
                                ?>
    
                                <li class="slide">
                                    <a href="<?php echo $img_url; ?>" title="<?php _e('Zoom Image','wpex'); ?>" rel="prettyPhoto[gallery_gallery]"><img src="<?php echo $featured_image; ?>" alt="<?php echo the_title(); ?>" /></a>
                                </li>
                                <?php } //not in rotator
                                    endforeach; //end attachment loop
                                ?>
                            </ul><!-- /slides -->
                        </div><!-- /flexslider -->
                    </div><!-- /flexslider-container -->
                <?php } ?>
            </div><!-- /single-gallery-media -->
    
            <header id="single-gallery-heading">
                <h1><?php the_title(); ?></h1>
            </header><!-- /single-gallery-heading -->
    
            <article id="single-gallery-info" class="entry clearfix">
    
            	<div id="single-gallery-left">
                    <ul id="gallery-meta">
                        <li><span class="wpex-icon-calendar"></span><?php the_date(); ?></li>
                        <?php
    					$gallery_cats = get_the_term_list( get_the_ID(), 'gallery_cats', '', ', ', ' ');
                        if($gallery_cats) { ?><li><span class="wpex-icon-folder-open"></span><?php echo $gallery_cats; ?></li><?php } ?>
    
                        <?php
    					$gallery_authors = get_the_term_list( get_the_ID(), 'gallery_authors', '', ', ', ' ');
                        if($gallery_authors) { ?><li><span class="wpex-icon-user"></span><?php echo $gallery_authors; ?></li><?php } ?>
    
                        <?php
    					//license meta
    					$gallery_license = get_post_meta($post->ID, 'wpex_gallery_license', TRUE);
    					$gallery_license_url = get_post_meta($post->ID, 'wpex_gallery_license_url', TRUE);
    					//show license if text exists
    					if($gallery_license) {
    						if($gallery_license_url) {
    					?>
                        	<li><span class="wpex-icon-legal"></span><a href="<?php echo $gallery_license_url; ?>" title="<?php echo $gallery_license; ?>" target="_blank"><?php echo $gallery_license; ?></a></li>
                        <?php } else { ?>
                        	<li><span class="wpex-icon-legal"></span><?php echo $gallery_license; ?></li>
                        <?php } } ?>
                    </ul><!-- /gallery-meta -->
    				<?php
                    //buttons meta/defaults
                    $gallery_green_btn_txt = get_post_meta($post->ID, 'wpex_gallery_green_btn_txt', TRUE);
                    $gallery_green_btn_url = get_post_meta($post->ID, 'wpex_gallery_green_btn_url', TRUE);
    				$gallery_green_btn_url_target = get_post_meta($post->ID, 'wpex_gallery_green_btn_url_target', TRUE);
    				$gallery_green_btn_icon = get_post_meta($post->ID, 'wpex_gallery_green_btn_icon', TRUE);
    				$gallery_green_btn_icon = ($gallery_green_btn_icon != 'Select') ? $gallery_green_btn_icon : 'external-link';
    
                    $gallery_oj_btn_txt = get_post_meta($post->ID, 'wpex_gallery_oj_btn_txt', TRUE);
                    $gallery_oj_btn_url = get_post_meta($post->ID, 'wpex_gallery_oj_btn_url', TRUE);
    				$gallery_oj_btn_url_target = get_post_meta($post->ID, 'wpex_gallery_oj_btn_url_target', TRUE);
    				$gallery_oj_btn_icon = get_post_meta($post->ID, 'wpex_gallery_oj_btn_icon', TRUE);
    				$gallery_oj_btn_icon = ($gallery_oj_btn_icon != 'Select') ? $gallery_oj_btn_icon : 'download-alt';
    
                    //show buttons if either green or orange have values
                    if($gallery_green_btn_url || $gallery_oj_btn_url) {
                    ?>
                    <div id="gallery-buttons">
                        <?php if($gallery_green_btn_url) { ?><a href="<?php echo $gallery_green_btn_url; ?>" class="button green" title="<?php echo $gallery_green_btn_txt; ?>" target="_<?php echo $gallery_green_btn_url_target; ?>"><span class="button-inner"><span class="wpex-icon-<?php echo $gallery_green_btn_icon; ?>"></span><?php echo $gallery_green_btn_txt; ?></span></a><?php } ?>
                        <?php if($gallery_oj_btn_url) { ?><a href="<?php echo $gallery_oj_btn_url; ?>" class="button orange" title="<?php echo $gallery_oj_btn_txt; ?>" target="_<?php echo $gallery_oj_btn_url_target; ?>"><span class="button-inner"><span class="wpex-icon-<?php echo $gallery_oj_btn_icon; ?>"></span><?php echo $gallery_oj_btn_txt; ?></span></a><?php } ?>
                    </div><!-- /gallery-buttons -->
                    <?php } ?>
    
                    <?php
    				//custom content
    				$gallery_meta_custom = get_post_meta($post->ID, 'wpex_gallery_meta_custom', TRUE);
    
    				if($gallery_meta_custom) {
    					echo '<div class="gallery-custom-meta">'. do_shortcode($gallery_meta_custom) .'</div>';
    				} ?>
                </div><!--/single-gallery-left-->
    
                <div id="single-gallery-right">
                	<?php the_content(); ?>
    				<?php
    				//post tags
    				if(of_get_option('gallery_tags')) {
    					$gallery_tags = get_the_term_list( get_the_ID(), 'gallery_tags', '', '', '' );
    						if($gallery_tags) {
    						echo '<div id="gallery-post-tags" class="clearfix">';
    							echo '<h3>'. __('Tags','wpex') .'</h3>';
    							echo $gallery_tags;
    						echo '</div>';
    					}
    				} ?>
                </div><!--/single-gallery-right-->
            </article><!-- /single-gallery-info -->
    
            <?php
            //get comments if enabled
    		if(of_get_option('gallery_comments')) {
            comments_template(); } ?>
      	</div><!-- /container -->
    
    	<nav id="single-nav" class="clearfix">
    		<?php next_post_link('<div id="single-nav-left">%link</div>', '<span class="wpex-icon-chevron-left"></span>%title', false); ?>
    		<?php previous_post_link('<div id="single-nav-right">%link</div>', '%title<span class="wpex-icon-chevron-right"></span>', false); ?>
    	</nav><!-- /single-nav --> 
    
    </article><!-- /post -->
    <?php
    //end post loop
    endwhile; endif;
    
    //get sidebar
    get_sidebar('gallery'); ?>
    
    <?php
    //related posts if enabled
    if(of_get_option('gallery_related')) {
    	//get related gallery posts
    	$cats = wp_get_post_terms($post->ID, 'gallery_cats');
    
    	//don't even bother if there aren't any gallery categories
    	if($cats) { 
    
    		//loop arguments
    		$args = array(
    			'post__not_in' => array( $post->ID ),
    			'orderby'=> 'post_date',
    			'order' => 'rand',
    			'post_type' => 'gallery',
    			'posts_per_page' => 4,
    			'tax_query' => array(
    				'relation' => 'OR',
    				array(
    					'taxonomy' => 'gallery_cats',
    					'terms' => $cats[0]->term_id
    				),
    			)
    		);
    		$my_query = new WP_Query($args);
    		if( $my_query->have_posts() ) {
    		?>
    		<div class="clear"></div>
    		<div id="single-gallery-related" class="clearfix">
    			<h3><?php _e('Related Items','wpex'); ?></h3>
    			<div class="grid-container">
                	<?php
    				while ($my_query->have_posts()) : $my_query->the_post();
    					//get the gallery loop style
    					get_template_part('includes/loop','gallery');
    				endwhile; ?>
    			</div><!--/grid-container -->
    		</div><!-- /single-gallery-related -->
    		<?php
    			wp_reset_query(); //prevent this custom query from messing up other queries
    			} //no posts
    		} //no cats
    } //related posts disabled ?>
    
    <?php
    //get template footer
    get_footer(); ?>

    heres the page.php

    <?php
    /**
     * @package WordPress
     * @subpackage WPEX WordPress Framework
     */
    
    //get template header
    get_header();
    
    //start post loop
    if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <article id="post" class="container clearfix">
        <header id="single-heading">
            <h1><?php the_title(); ?></h1>
        </header><!-- /single-heading -->
    
        <div class="entry clearfix">
            <?php the_content(); ?>
        </div><!-- /entry -->
    </article><!-- /post -->
    
    <?php
    //end post loop
    endwhile; endif;
    
    //get sidebar template
    get_sidebar('pages');
    
    //get footer template
    get_footer(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags