0

i am using onioneye, Ying yang theme and for pagination, i am using wordpress visual pagination plugin but where i am pasting the pagination code, it shows nothing :( template is:

    <?php
    /*
    Template Name: Home
    */
    ?>
<?php get_header(); ?>

    <?php
        //function wp_paginate($args = false) {
    //global $wp_paginate;
    //$wp_paginate->type = 'posts';
    //return $wp_paginate->paginate($args);
    //}
        //echo "hello";
        $count = 0;
        $id_suffix = 1;
        $items_per_row = 4;
        $quality = 90;                      
        $my_query = new WP_Query( array( 'posts_per_page' => '-1', 'post_type' => 'portfolio' ) );
        $grid_class = 'grid_3';
        $desired_width = 220;
        $desired_height = 190;
        $terms = get_terms( 'portfolio_categories' ); 
        $count_terms = count( $terms ); 

                //echo "<pre>";
                //print_r($my_query);
                //echo "</pre>";
    ?>

    <!-- START #project-wrapper -->
    <div id="project-wrapper"></div>
    <!-- END #project-wrapper -->

    <!-- START #portfolio-header -->
    <div id="portfolio-header" class="grid_12 alpha omega group <?php if( ! $intro_text     ) echo 'no-intro'; ?>">  

        <h2><?php _e( 'Portfolio', 'onioneye' ); ?></h2>

        <!-- START #filter -->
        <ul id="filter" class="group">

            <!-- START .active -->
            <li class="active">
                <a href="#" class="all" title="<?php _e( 'View all items',  'onioneye' ); ?>">

                    <span class="term-name"><?php _e( 'All', 'onioneye'  ); ?></span>

                    <!-- START .term-count -->
                    <span class="term-count">
                        <?php echo wp_count_posts( 'portfolio' )->publish; ?>
                        <span class="triangle-down"></span>
                    </span>
                    <!-- END .term-count -->

                </a>
            </li>
            <!-- END .active -->

            <?php if ( $count_terms > 0 ) { ?>

                <?php foreach ( $terms as $term ) { ?>

                    <li>
                        <a class="<?php echo $term->slug; ?>" href="#" title="<?php printf ( __( 'View all items filed under %s', 'onioneye' ), $term->name ); ?>">

                            <span class="term-name"><?php echo $term->name; ?></span>

                            <!-- START .term-count -->
                            <span class="term-count"><?php echo $term->count; ?><span class="triangle-down"></span></span>
                            <!-- END .term-count -->

                        </a>
                    </li>

                <?php } ?>

            <?php } ?>

        </ul>
        <!-- END #filter -->

    </div>  
    <!-- END #portfolio-header -->

    <!-- START .portfolio-gallery -->           
    <ul id="filterable-gallery" class="portfolio-gallery four-items-per-row grid_12 alpha omega">

    <?php while ( $my_query -> have_posts()) : $my_query -> the_post(); //query the "portfolio" custom post type for portfolio items ?>

        <?php $preview_img_url = eq_get_the_preview_img_url(); ?>
        <?php $count++; ?>

        <!-- START .portfolio-item -->
        <li data-id="id-<?php echo $id_suffix; ?>" <?php $terms = get_the_terms( $post -> ID, 'portfolio_categories' ); if ( !empty( $terms ) ) { echo 'data-group="'; foreach( $terms as $term ) { echo $term -> slug . ' '; } echo '"'; } ?> class="portfolio-item <?php echo $grid_class; ?> <?php if( $count === 1 ) { echo 'alpha'; } elseif( $count === $items_per_row ) { echo 'omega'; } ?>">

            <!-- START .project -->
            <figure class="project">   

                <?php echo $nonce = wp_create_nonce("portfolio_item_nonce"); ?>

                <!-- START .project-link -->
                <a class="project-link" href="<?php the_permalink(); ?>" data-post_id="<?php echo $post->ID; ?>" data-nonce="<?php echo $nonce; ?>">

                    <?php if ( $preview_img_url ) { ?>

                    <?php
                        $image_details = wp_get_attachment_image_src( eq_get_attachment_id_from_src( $preview_img_url ), 'full');
                        $image_full_width = $image_details[1];
                        $image_full_height = $image_details[2];

                        // If the original width of the thumbnail doesn't match the width of the slider, resize it; otherwise, display it in original size
                        if( $image_full_width > $desired_width || $image_full_height > $desired_height ) { 
                    ?>
                            <img width="<?php echo $desired_width; ?>" height="<?php echo $desired_height; ?>" src="<?php echo get_template_directory_uri() . '/timthumb.php?src=' . $image_details[0]; ?>&amp;h=<?php echo $desired_height; ?>&amp;w=<?php echo $desired_width; ?>&amp;q=<?php echo $quality; ?>" alt="<?php the_title(); ?>" />

                    <?php 
                        } else { 
                    ?>                          
                            <img width="<?php echo $desired_width; ?>" height="<?php echo $desired_height; ?>" src="<?php echo $preview_img_url; ?>" alt="<?php the_title(); ?>" />                               
                    <?php 
                        } 
                    ?>

                        <span class="project-overlay">View Details</span>

                        <div class="project-content">
                            <h3 class="project-caption"><?php the_title(); ?></h3> 
                            <img class="view-button" src="<?php echo get_template_directory_uri(); ?>/images/layout/view-details.png" />
                        </div>

                    </a>
                    <!-- END .project-link -->

                    <span class="blocked-project-overlay"></span>

                </figure>
                <!-- START .project -->

            <?php } ?>

        </li>  
        <!-- END .portfolio-item -->

        <?php if( $count === $items_per_row ) { // if the current row is filled out with columns, reset the count variable ?>

            <?php  $count = 0; ?> 

        <?php } ?>
        <?php  $id_suffix++; ?>

    <?php endwhile;

        ?>

    </ul>
        <?php  $id_suffix;

      wp_paginate();

        ?>
    <!-- END .portfolio-gallery -->

    <?php if( of_get_option( 'client_logos' ) ) { // display the client logos if defined in the theme options panel ?>

        <div class="clients grid_12 alpha omega group">    
            <h2><?php _e( 'Clients', 'onioneye' ); ?></h2>

            <img class="client-logos" src="<?php echo of_get_option( 'client_logos' ); ?>" alt="client logos" />
        </div>  

    <?php } ?>

<?php get_footer(); ?>

and my function is included here

    <?php
    /*
     Plugin Name: WP-Paginate


    Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/
    Description: A simple and flexible pagination plugin for WordPress posts and comments.
    Author: Eric Martin
    Version: 1.2.4
    Author URI: http://www.ericmmartin.com
    Revision: $Id: wp-paginate.php 467949 2011-11-26 20:03:29Z emartin24 $
    */

    /*  Copyright 2011 Eric Martin ([email protected])

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

    */

    /**
     * Set the wp-content and plugin urls/paths
     */
    if (!defined('WP_CONTENT_URL'))
        define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
    if (!defined('WP_CONTENT_DIR'))
        define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
    if (!defined('WP_PLUGIN_URL') )
        define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins');
    if (!defined('WP_PLUGIN_DIR') )
        define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins');

    if (!class_exists('WPPaginate')) {

    class WPPaginate {
        /**
         * @var string The plugin version
         */
        var $version = '1.2.4';

        /**
         * @var string The options string name for this plugin
         */
        var $optionsName = 'wp_paginate_options';

        /**
         * @var string $localizationDomain Domain used for localization
         */
        var $localizationDomain = 'wp-paginate';

        /**
         * @var string $pluginurl The url to this plugin
         */
        var $pluginurl = '';
        /**
         * @var string $pluginpath The path to this plugin
         */
        var $pluginpath = '';

        /**
         * @var array $options Stores the options for this plugin
         */
        var $options = array();

        var $type = 'posts';

        /**
         * PHP 4 Compatible Constructor
         */
        function WPPaginate() {$this->__construct();}

        /**
         * PHP 5 Constructor
         */
        function __construct() {
            $name = dirname(plugin_basename(__FILE__));

            //Language Setup
            load_plugin_textdomain($this->localizationDomain, false, "$name/I18n/");

            //"Constants" setup
            $this->pluginurl = plugins_url($name) . "/";
            $this->pluginpath = WP_PLUGIN_DIR . "/$name/";

            //Initialize the options
            $this->get_options();

            //Actions
            add_action('admin_menu', array(&$this, 'admin_menu_link'));

            if ($this->options['css'])
                add_action('wp_print_styles', array(&$this, 'wp_paginate_css'));
        }

        /**
         * Pagination based on options/args
         */
        function paginate($args = false) {

            if ($this->type === 'comments' && !get_option('page_comments'))
                return;

            $r = wp_parse_args($args, $this->options);
            extract($r, EXTR_SKIP);

            if (!isset($page) && !isset($pages)) {
                global $wp_query;
                                $paged = get_query_var('paged') ? get_query_var('paged') : 1;

                                //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        //                        $wp_query = new WP_Query();

                                //$wp_query = new WP_Query( 'post_type=portfolio&showposts=12' );
                                $wp_query->query('post_type=portfolio&posts_per_page=16&paged=' . $paged);
                                //echo "<pre>";
                                //print_r($wp_query);
                                //echo "</pre>";
                                echo $wp_query->found_posts."<br />";
                if ($this->type === 'posts') {
                    $page = get_query_var('paged');
                    echo $posts_per_page =    intval(get_query_var('posts_per_page'))."<br />";
                    echo $pages = intval(ceil($wp_query->found_posts / $posts_per_page))."<br />";
                }
                else {
                    $page = get_query_var('cpage');
                    $comments_per_page = get_option('comments_per_page');
                    $pages = get_comment_pages_count();
                }
                 $page = !empty($page) ? intval($page) : 1;
            }

             $prevlink = ($this->type === 'posts')
                ? esc_url(get_pagenum_link($page - 1))
                : get_comments_pagenum_link($page - 1);
            $nextlink = ($this->type === 'posts')
                ? esc_url(get_pagenum_link($page + 1))
                : get_comments_pagenum_link($page + 1);

            $output = stripslashes($before);
            if ($pages > 1) {
                            echo "hello <br />";
                            echo wp-paginate-comments;
                $output .= sprintf('<ol class="wp-paginate%s">', ($this->type === 'posts') ? '' : ' wp-paginate-comments');
                $output .= sprintf('<li><span class="title">%s</span></li>', stripslashes($title));
                $ellipsis = "<li><span class='gap'>...</span></li>";

                if ($page > 1 && !empty($previouspage)) {
                                    echo "lpc";
                    $output .= sprintf('<li><a href="%s" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
                }

                $min_links = $range * 2 + 1;
                $block_min = min($page - $range, $pages - $min_links);
                $block_high = max($page + $range, $min_links);
                $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
                $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;

                if ($left_gap && !$right_gap) {
                    $output .= sprintf('%s%s%s',
                        $this->paginate_loop(1, $anchor),
                        $ellipsis,
                        $this->paginate_loop($block_min, $pages, $page)
                    );
                }
                else if ($left_gap && $right_gap) {
                    $output .= sprintf('%s%s%s%s%s',
                        $this->paginate_loop(1, $anchor),
                        $ellipsis,
                        $this->paginate_loop($block_min, $block_high, $page),
                        $ellipsis,
                        $this->paginate_loop(($pages - $anchor + 1), $pages)
                    );
                }
                else if ($right_gap && !$left_gap) {
                    $output .= sprintf('%s%s%s',
                        $this->paginate_loop(1, $block_high, $page),
                        $ellipsis,
                        $this->paginate_loop(($pages - $anchor + 1), $pages)
                    );
                }
                else {
                    $output .= $this->paginate_loop(1, $pages, $page);
                }

                if ($page < $pages && !empty($nextpage)) {
                    $output .= sprintf('<li><a href="%s" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
                }
                $output .= "</ol>";
            }
            $output .= stripslashes($after);

            if ($pages > 1 || $empty) {
                echo $output;
            }

        }

        /**
         * Helper function for pagination which builds the page links.
         */
        function paginate_loop($start, $max, $page = 0) {
            $output = "";
            for ($i = $start; $i <= $max; $i++) {
                $p = ($this->type === 'posts') ? esc_url(get_pagenum_link($i)) : get_comments_pagenum_link($i);
                $output .= ($page == intval($i))
                    ? "<li><span class='page current'>$i</span></li>"
                    : "<li><a href='$p' title='$i' class='page'>$i</a></li>";
            }
            return $output;
        }

        function wp_paginate_css() {
            $name = "wp-paginate.css";
            if (false !== @file_exists(TEMPLATEPATH . "/$name")) {
                $css = get_template_directory_uri() . "/$name";
            }
            else {
                $css = $this->pluginurl . $name;
            }
            wp_enqueue_style('wp-paginate', $css, false, $this->version, 'screen');

            if (function_exists('is_rtl') && is_rtl()) {
                $name = "wp-paginate-rtl.css";
                if (false !== @file_exists(TEMPLATEPATH . "/$name")) {
                    $css = get_template_directory_uri() . "/$name";
                }
                else {
                    $css = $this->pluginurl . $name;
                }
                wp_enqueue_style('wp-paginate-rtl', $css, false, $this->version, 'screen');
            }
        }

        /**
         * Retrieves the plugin options from the database.
         * @return array
         */
        function get_options() {
            if (!$options = get_option($this->optionsName)) {
                $options = array(
                    'title' => 'Pages:',
                    'nextpage' => '&raquo;',
                    'previouspage' => '&laquo;',
                    'css' => true,
                    'before' => '<div class="navigation">',
                    'after' => '</div>',
                    'empty' => true,
                    'range' => 3,
                    'anchor' => 1,
                    'gap' => 3
                );
                update_option($this->optionsName, $options);
            }
            $this->options = $options;
        }
        /**
         * Saves the admin options to the database.
         */
        function save_admin_options(){
            return update_option($this->optionsName, $this->options);
        }

        /**
         * @desc Adds the options subpanel
         */
        function admin_menu_link() {
            add_options_page('WP-Paginate', 'WP-Paginate', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page'));
            add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 );
        }

        /**
         * @desc Adds the Settings link to the plugin activate/deactivate page
         */
        function filter_plugin_actions($links, $file) {
            $settings_link = '<a href="options-general.php?page=' . basename(__FILE__) . '">' . __('Settings', $this->localizationDomain) . '</a>';
            array_unshift($links, $settings_link); // before other links

            return $links;
        }

        /**
         * Adds settings/options page
         */
        function admin_options_page() {
            if (isset($_POST['wp_paginate_save'])) {
                if (wp_verify_nonce($_POST['_wpnonce'], 'wp-paginate-update-options')) {
                    $this->options['title'] = $_POST['title'];
                    $this->options['previouspage'] = $_POST['previouspage'];
                    $this->options['nextpage'] = $_POST['nextpage'];
                    $this->options['before'] = $_POST['before'];
                    $this->options['after'] = $_POST['after'];
                    $this->options['empty'] = (isset($_POST['empty']) && $_POST['empty'] === 'on') ? true : false;
                    $this->options['css'] = (isset($_POST['css']) && $_POST['css'] === 'on') ? true : false;
                    $this->options['range'] = intval($_POST['range']);
                    $this->options['anchor'] = intval($_POST['anchor']);
                    $this->options['gap'] = intval($_POST['gap']);

                    $this->save_admin_options();

                    echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', $this->localizationDomain) . '</p></div>';
                }
                else {
                    echo '<div class="error"><p>' . __('Whoops! There was a problem with the data you posted. Please try again.', $this->localizationDomain) . '</p></div>';
                }
            }
?>

<div class="wrap">
<div class="icon32" id="icon-options-general"><br/></div>
<h2>WP-Paginate</h2>
<form method="post" id="wp_paginate_options">
<?php wp_nonce_field('wp-paginate-update-options'); ?>
    <table class="form-table">
        <tr valign="top">
            <th scope="row"><?php _e('Pagination Label:', $this->localizationDomain); ?></th>
            <td><input name="title" type="text" id="title" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['title'])); ?>"/>
            <span class="description"><?php _e('The text/HTML to display before the list of pages.', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Previous Page:', $this->localizationDomain); ?></th>
            <td><input name="previouspage" type="text" id="previouspage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['previouspage'])); ?>"/>
            <span class="description"><?php _e('The text/HTML to display for the previous page link.', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Next Page:', $this->localizationDomain); ?></th>
            <td><input name="nextpage" type="text" id="nextpage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['nextpage'])); ?>"/>
            <span class="description"><?php _e('The text/HTML to display for the next page link.', $this->localizationDomain); ?></span></td>
        </tr>
    </table>
    <p>&nbsp;</p>
    <h3><?php _e('Advanced Settings', $this->localizationDomain); ?></h3>
    <table class="form-table">
        <tr valign="top">
            <th scope="row"><?php _e('Before Markup:', $this->localizationDomain); ?></th>
            <td><input name="before" type="text" id="before" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['before'])); ?>"/>
            <span class="description"><?php _e('The HTML markup to display before the pagination code.', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('After Markup:', $this->localizationDomain); ?></th>
            <td><input name="after" type="text" id="after" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['after'])); ?>"/>
            <span class="description"><?php _e('The HTML markup to display after the pagination code.', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Markup Display:', $this->localizationDomain); ?></th>
            <td><label for="empty">
                <input type="checkbox" id="empty" name="empty" <?php echo ($this->options['empty'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Show Before Markup and After Markup, even if the page list is empty?', $this->localizationDomain); ?></label></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('WP-Paginate CSS File:', $this->localizationDomain); ?></th>
            <td><label for="css">
                <input type="checkbox" id="css" name="css" <?php echo ($this->options['css'] === true) ? "checked='checked'" : ""; ?>/> <?php printf(__('Include the default stylesheet wp-paginate.css? WP-Paginate will first look for <code>wp-paginate.css</code> in your theme directory (<code>themes/%s</code>).', $this->localizationDomain), get_template()); ?></label></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Page Range:', $this->localizationDomain); ?></th>
            <td>
                <select name="range" id="range">
                <?php for ($i=1; $i<=10; $i++) : ?>
                    <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['range']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
                <?php endfor; ?>
                </select>
                <span class="description"><?php _e('The number of page links to show before and after the current page. Recommended value: 3', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Page Anchors:', $this->localizationDomain); ?></th>
            <td>
                <select name="anchor" id="anchor">
                <?php for ($i=0; $i<=10; $i++) : ?>
                    <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['anchor']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
                <?php endfor; ?>
                </select>
                <span class="description"><?php _e('The number of links to always show at beginning and end of pagination. Recommended value: 1', $this->localizationDomain); ?></span></td>
        </tr>
        <tr valign="top">
            <th scope="row"><?php _e('Page Gap:', $this->localizationDomain); ?></th>
            <td>
                <select name="gap" id="gap">
                <?php for ($i=1; $i<=10; $i++) : ?>
                    <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['gap']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
                <?php endfor; ?>
                </select>
                <span class="description"><?php _e('The minimum number of pages in a gap before an ellipsis (...) is added. Recommended value: 3', $this->localizationDomain); ?></span></td>
        </tr>
    </table>
    <p class="submit">
        <input type="submit" value="Save Changes" name="wp_paginate_save" class="button-primary" />
    </p>
</form>
<h2><?php _e('Need Support?', $this->localizationDomain); ?></h2>
<p><?php printf(__('For questions, issues or feature requests, please post them in the %s and make sure to tag the post with wp-paginate.', $this->localizationDomain), '<a href="http://wordpress.org/tags/wp-paginate?forum_id=10#postform">WordPress Forum</a>'); ?></p>
<h2><?php _e('Like To Contribute?', $this->localizationDomain); ?></h2>
<p><?php _e('If you would like to contribute, the following is a list of ways you can help:', $this->localizationDomain); ?></p>
<ul>
    <li>&raquo; <?php _e('Translate WP-Paginate into your language', $this->localizationDomain); ?></li>
    <li>&raquo; <?php _e('Blog about or link to WP-Paginate so others can find out about it', $this->localizationDomain); ?></li>
    <li>&raquo; <?php _e('Report issues, provide feedback, request features, etc.', $this->localizationDomain); ?></li>
    <li>&raquo; <a href="http://wordpress.org/extend/plugins/wp-paginate/"><?php _e('Rate WP-Paginate on the WordPress Plugins Page', $this->localizationDomain); ?></a></li>
    <li>&raquo; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KUL9VQ6U5VYCE&lc=US&item_name=Eric%20Martin%20%28ericmmartin%2ecom%29&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted"><?php _e('Make a donation', $this->localizationDomain); ?></a></li>
</ul>
<h2><?php _e('Other Links', $this->localizationDomain); ?></h2>
<ul>
    <li>&raquo; <a href="http://twitter.com/ericmmartin">@ericmmartin</a> on Twitter</li>
    <li>&raquo; <a href="http://www.ericmmartin.com">EricMMartin.com</a></li>
    <li>&raquo; <a href="http://www.ericmmartin.com/projects/smcf/">SimpleModal Contact Form (SMCF) - WordPress Plugin</a></li>
    <li>&raquo; <a href="http://www.ericmmartin.com/projects/simplemodal-login/">SimpleModal Login - WordPress Plugin</a></li>
</ul>
</div>

<?php
        }
    }
}

//instantiate the class
if (class_exists('WPPaginate')) {
    $wp_paginate = new WPPaginate();
}

/**
 * Pagination function to use for posts
 */
function wp_paginate($args = false) {
    //echo "hello";
    global $wp_paginate;
    $wp_paginate->type = 'posts';
    return $wp_paginate->paginate($args);
}

/**
 * Pagination function to use for post comments
 */
function wp_paginate_comments($args = false) {
    global $wp_paginate;
    $wp_paginate->type = 'comments';
    return $wp_paginate->paginate($args);
}

/*
 * The format of this plugin is based on the following plugin template:
 * http://pressography.com/plugins/wordpress-plugin-template/
 */
?>
5
  • Where are you pasting the wp_pagenavi() code? Do you have enough posts for pagination to show? Commented Nov 13, 2012 at 21:07
  • I am not getting that how to set the limit? I am pasting it below the listing Commented Nov 13, 2012 at 21:21
  • Please show us the code for the entire template file (the loop/query part).
    – Adam
    Commented Nov 13, 2012 at 23:11
  • @userabuser please see my edit in question. I am in a big mess :(. now i am able to see the pagination but it shows the same data on every page Commented Nov 13, 2012 at 23:24
  • Is the issue only in the context of custom query loop pagination? If so, please use the site search to find a plethora of questions and solutions to that problem. Commented Nov 13, 2012 at 23:53

1 Answer 1

1

Try the following;

global $wp_query;
global $paged;
$temp = $wp_query;
$wp_query = null;

$args  = array( 
    'post_type' => 'portfolio', 
    'paged' => $paged, 
    'posts_per_page' => -1, 
);

$wp_query = new WP_Query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();

//do your output here...

endwhile;

//do your pagination here...
wp_paginate();
$wp_query = null; 
$wp_query = $temp;

...also this,

<?php
/*
Template Name: Home
*/
?>

...indicates that you are trying to use this template for the homepage right? Would this file happen to be named also home.php ?

In that case can you tell us what you have set under the following;

enter image description here

Update: (lets debug the query)

Beneath this line;

$wp_query = new WP_Query( $args );

Please paste..

var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');

So it looks like;

...etc
$wp_query = new WP_Query( $args );
var_dump('<pre>', $paged, '</pre>');
var_dump('<pre>', $wp_query, '</pre>');
...etc

Then copy the output to http://www.pastebin.com so we can inspect whats going on in the query.

13
  • well this file is named as 'template-home.php' Commented Nov 14, 2012 at 0:34
  • I have set it exactly tha same as given in the attachemnt, but it shows nothing :( Commented Nov 14, 2012 at 0:40
  • Ok so are you trying to get these posts to display on the homepage? Which page have you assigned this template-home.php template to?
    – Adam
    Commented Nov 14, 2012 at 0:45
  • i have assigned the home page to this template, yes i am trying to get these posts to home page Commented Nov 14, 2012 at 0:47
  • 1
    yes it is :) Thanks to you sir, you were really helpfull :) Commented Nov 15, 2012 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.