Support » Theme: .TUBE » Creating other pages of categories of videos

  • joesegal

    (@joesegal)



    This theme defaults to the latest posts as the index page.
    How does one create a category page and show only videos from that category so I could designate that page as the new index page if I want to?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author tubegtld

    (@tubegtld)

    A few approaches are possible here, but “simplest” is probably to create a little plugin (or drop some code in functions.php if using a child theme) to intercept the pre_get_posts for the main query on your homepage and specify a category.

    Should look something like this, which is tested and working on a local install…

    add_action( 'pre_get_posts', 'only_one_category_on_home' ); 
    
    function only_one_category_on_home( $query ){
    
      if ( ! is_admin() && $query->is_main_query() && is_home() ):
        $query->set( 'cat', '615' ); // set to your category ID
      endif;
    
    }

    Note that “cat” expects a category ID. You can see other options here…
    https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

    Please mark as resolved if that helps, and please leave a review if you’re digging the theme.

    joesegal

    (@joesegal)

    Thanks.
    I’m not a programmer.
    I appreciate your help and theme however I really think this should be a built in feature as its logical people should be able to organize a video site by categories and create pages for different categories.

    Theme Author tubegtld

    (@tubegtld)

    Hey there. Appreciate your feedback.

    While I don’t necessarily agree this should be built into the theme, I would like for you to achieve your goal without programming.

    Thus, I’ve created a plugin just for you…

    1) Download the plugin…
    https://www.dropbox.com/s/0ghzslhi1trpcuv/joesegals-homepage-category.zip

    2) Go to “Plugins > Add New” and click “Upload Plugin” to install the plugin, then be sure to activate it

    3) Navigate to “Settings > Reading” in your Admin, where you should see a “Home Category” setting at the bottom with a dropdown of categories

    4) Select your desired category and hit “Save Changes”

    5) Navigate to your homepage to see if it did the trick

    6) Don’t say I never did anything for you 😉

    As before, please mark as resolved if this does the trick, and please do consider leaving a review as well.

    Theme Author tubegtld

    (@tubegtld)

    Sorry, also want to address your comment…

    > people should be able to organize a video site by
    > categories and create pages for different categories

    As noted in your plugin support ticket there is nothing preventing you from using the standard WordPress categories taxonomy and category archive pages, which will work “out of the box” provided you’re importing into the standard “post” post type.

    e.g. http://www.mysite.com/category/my-category

    The reason your request is “special” is that you’re looking to do this on your homepage, and category archives aren’t really “pages” so you can’t assign that as a static homepage page.

    Anyway, please let me know how the plugin works for you.

    joesegal

    (@joesegal)

    Thanks I just saw this reply tonight. I’ll test it tomorrow and let you know.
    I really appreciate your effort!

    Theme Author tubegtld

    (@tubegtld)

    Hey – Were you able to test this?

    Theme Author tubegtld

    (@tubegtld)

    Hi Joe,

    I spent a good amount of time hooking up that plugin for you… would really love to know if it worked out or not?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Creating other pages of categories of videos’ is closed to new replies.