Forums

wordTube
Searching of videos & pagination (3 posts)

  1. mmln
    Member
    Posted 1 year ago #

    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 ?

  2. mmln
    Member
    Posted 1 year ago #

    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.

  3. Vinoj Cardoza
    Member
    Posted 9 months ago #

    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, ));

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags