You can put the same portal on each tab and set up different portal filters that filter for specific sub categories. The buttons can simply use go to object to select the appropriate tab. (And you might just remove the buttons and have the user click the tabs.)
Note that you have to use the Name box in the Inspector to assign each tab panel a different object name to use with your button scripts for the buttons to work.
Thats the issue. I have to create the tabs in advance but some themes will require 2 tabs (because it has 2 Theme_Subcategory records) other will require 3 or 4 depending on the number of records in the Theme_Subcategory Field. from my understanding of your explanation the tabs must be set in advance right? Is there another solution?
Yes. If you are going to use a tab control for this, the tab panels must be created in advance.
But you don't really need a tab control for what you have described.
You can set up a single portal, not part of any tab control and your buttons can update the portal to show different related records.
The relationship for your portal can include a match field that matches only to a specific sub cateogry
Themes::ThemeID = Content::ThemeID AND
Themes::SelectedSubCat = Content::SubCateogry
Your buttons can change SelectedSubCat to different subCategory values to show different content in the portal. (And if there is never more than one record to show for a given selected subCategory, you don't need the portal, you can just add the fields from Content to your Themes layout.