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

Link to comment
https://forums.phpfreaks.com/topic/297132-how-can-i-add-pagination/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.