WordPress.org

Ready to get started?Download WordPress

Forums

I need help coding my Videos page and making it multiple pages! (3 posts)

  1. Rick Lamers
    Member
    Posted 4 years ago #

    Hi guys im having a bit of a problem. I need some help trying to make this custom video-display page.

    I have a page called Videos where I display all videos. I want people to be able to narrow down the ammount of videos shown by choosing a sub-category of the video's. How should I do this?

    I now made a page with a custom template which shows all videos of Cat=3 that is the Video category. Now I want people to be able to click a sub-cat and narrow down the amount of video's shown.

    Example:

    Menu>Videos. They come on a page with all kinds of videos. Now lets say I made 2 sub categories in Videos. Dogs ands Cats. I want people to be able to click on a link which says "Cats" and then only display the same page with same lay-out with only videos from category ID = 5 (Which then would be the categorie Cats with the Mother category 3 for Videos)

    You can let your responses back here on my email ricklames@gmail.com

    Here is the code I use for displaying a certain cat on the All Videos page:

    <?php $my_query = new WP_Query('cat=3&posts_per_page=10'); ?>
    
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

    Also I want the All Videos page to display all posts found in the category and with more then 10 found break them down into pages.

    If any1 cares to fix this for me I will thank him so much! And might even reward him with some dollars/euros.

    Thanks in Advance! Rick Lamers

    Please help ^^

  2. kz
    Member
    Posted 4 years ago #

    Rename 'custom video-display page' to category.php
    and use main loop only:

    while(have_posts()) :
      the_posts();
      /* do stuff */
    endwhile;

    Below outputs category link:
    <a href="<?php echo get_category_link(3 /* category ID */) ?>">Videos</a>

    If you have other category pages,
    create category.php and edit it like:

    $post = $wp_query->post;
    if(is_category(array(3, 4, 5))){ // for Videos, Dogs and Cats
     include(TEMPLATEPATH . '/cat-videos.php'); // if filename is category-videos.php, it will not work.
     } else if(is_category(array('sounds', 'sounds-sub'))){
     include(TEMPLATEPATH . '/cat-sounds.php');
     } else if(is_category(array(123, 456))){
     include(TEMPLATEPATH . '/cat-123.php');
     } else {
     include(TEMPLATEPATH . '/cat-default.php');
     }
  3. Rick Lamers
    Member
    Posted 4 years ago #

    Im going to try this! Thanks you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic