Jump to content

How can i add pagination?


colap

Recommended Posts

<?php

/**
 * @package createtags
 */
/*
  Plugin Name: createtags
  Plugin URI:
  Description: Creating tags from title of posts
  Version: 1.0
  Author: php-coder
  Author URI:
 */

function my_plugin_menu() {
    add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
}

function my_plugin_options() {
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    echo '<div class="wrap">';
    echo '<p>Here is where the form would go if I actually had options.</p>';
    echo '</div>';
    global $current_user;
    echo '<pre>';
    global $current_user;
    $user_roles = $current_user->roles;
    $user_role = array_shift($user_roles);
    //var_dump($user_role);

    $the_query = new WP_Query("select * from wp_posts");
// The Loop
    if ($the_query->have_posts()) {
        echo '<ul>';
        while ($the_query->have_posts()) {
            $the_query->the_post();
            echo '<li>' . get_the_title() . '</li>';
        }
        echo '</ul>';
    } else {
        echo "no posts found";
    }
    echo '</pre>';
}

add_filter('admin_menu', 'my_plugin_menu');

How can i add pagination here? This is wordpress-4.2.2

Edited by php-coder
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.