• So far I succeeded in creating a page template that has a custom query to get list of videos uploaded sorted by most viewed. Page template displays.

    SELECT * FROM $wpdb->wordtube ORDER BY counter desc

    For each video in the query output I display the thumbnail and hyperlink, upon clicking it opens the individual video.

    I need help with two things.

    1) I wan’t do add search functionality so that when searched only matching videos are displayed.

    2) I want to add pagination, so that videos more than 10 displayed in next page.

    Any PHP gurus can help me ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter mmln

    (@mmln)

    What I want (search and pagination) is pretty much available from admin screen, but don’t know how to cut and paste the code in page template so that it displays in wordpress pages.

    The following coding may be useful for your second query to add pagination.

    <form method=”post” action=””><input type=”text” name=”page_no” size=”1″/></form>
    <?php
    $no_of_posts_per_page = 9; //VC: Pass the value for the number of posts to be displayed per page
    $term = get_query_var(‘term’);
    $taxonomy = get_query_var(‘taxonomy’);
    if(isset($_POST[‘page_no’])) $i=$_POST[‘page_no’]; //VC: Check whether the user has given any page number in the text field. If not display the firstpage
    if(empty($i)) $i = 1; //VC: For pagination
    query_posts(array(
    ‘post_type’ => ‘video’,
    $taxonomy => $term,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => $no_of_posts_per_page,
    ‘paged’ => $i, ));

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: wordTube] Searching of videos & pagination’ is closed to new replies.