• Resolved dannybcastillo

    (@dannybcastillo)


    https://www.dannycastillo.com/wp/?page_id=27

    I want any viewer to click on post heading to see the gallery. But, I still want to have the year to stay above. Just like how I set of my page sub nav once you click gallery page.

    I am not sure if I need to create category-16.php or change something else?

    Any help would be great!

    Thanks

    DBC

Viewing 9 replies - 1 through 9 (of 9 total)
  • I’ll look into it for you. I have only done this on a Page page so far.

    What I am understanding is that you want a persistent submenu throughout your gallery section. If that’s correct than follow along.

    Ok, set up your Gallery page with a custom page template (“gallery.php”) that shows only posts from the specific parent category you want (custom loop). For the example let’s say the parent category is called “Gallery” with an ID# of 2. Next, set up some subcategories for your parent (years in your case, “2004”, “2005”, “2006”).

    In the “gallery.php” template use the template tag wp_list_cats() to show only the subcategories of the “gallery” category in an unordered list like so:

    <ul>
    <?php wp_list_cats('hide_empty=0&child_of=2'); ?>
    </ul>

    There lots of arguments you can place in here to customize it further if you like. One very important one is “file” which specifies a template to use to display the content of whichever category the user clicks on. Putting the above template tag in this template will keep that list of subcategories in there. From there you can put this in a single post view template as well.

    Thread Starter dannybcastillo

    (@dannybcastillo)

    Go to this thread
    https://www.ads-software.com/support/topic/79809?replies=3
    This plugin works great!

    Excellent. He makes the some of the most useful plugins. While working this out, I never really got to the part where I would need a separate template for a single post in a certain category. What happens if you tag your posts with more than one category? Does it default to the first one listed maybe?

    Thread Starter dannybcastillo

    (@dannybcastillo)

    I am not sure, because

    “first one listed”

    where?

    The first category that the post is tagged with. If you have a post that you tagged with three categories how does this plugin know which category to go by when determining a template?

    Thread Starter dannybcastillo

    (@dannybcastillo)

    In my conclusion…
    If you tag a post w/ three categories[parent], the plugin uses the first acedaning category number. Beacuse WP assigns all numbers this way to everything {post, pages, categories}. I think.

    My Example
    I made three categories.

    1. T1 | id#22
    2. T2 | id#23
    3. T3 | id#24

    I made four posts.

    1. with categories T1, T2, T3
    2. with categories T1, T3
    3. with categories T2, T3
    4. with categories T3

    I made three single-cat-#.php for the plugin to find. Using thier category id#.

    Results

    1. Post 1 used category T1 single view php
    2. Post 2 used category T1 single view php
    3. Post 3 used category T2 single view php
    4. Post 4 used category T3 single view php. Just make sure T3 sinngle view php worked.

    Post Can be viewed here.

    I hope this is what you where asking to see.

    Thanks for all the testing Danny. This makes my job so much easier.

    Thread Starter dannybcastillo

    (@dannybcastillo)

    Not a problem.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How do I customize how one category is viewed?’ is closed to new replies.