raindance

Member

Forum Replies Created

  • In reply to: Specific photo for specific category?

    #19707

    A really wonderful coder at the wordpress forum dialed this in beautifully for me.

    The code itself is here and really well commented.

    http://pastebin.com/7txapyW9

    The WP Forum thread is here if anyone wants to see more details about how we got there.

    http://wordpress.org/support/topic/specific-header-image-for-specific-category?replies=46

    This is for category archive pages and single posts to rotate custom header images from folders you create. It works great and is super easy to use. It doesn’t work for single pages, but I figure I can just use a single custom header on a page so it doesn’t matter too much. He may try to re-work it to include pages but maybe not. He spent a lot of time dialing this in. It’s really well done and a pleasure to have! If he does re-work it to include pages he will update the pastebin. Just subscribe to that thread for updates.

    Thanks for getting it started Syahir.

    I just found this in my child theme folder…don’t know what it’s there for or if relevant in the evolution, but…could it be making the code you gave me Syahir not work for what I’m trying to do?? I think it’s to make the word “category archive” not show up so probably not relevant but…

    I’m still waiting Syahir for you to help me finish this off please?

    category.php in child theme folder:

    <?php

    /**

    * The category archive template file

    *

    * @package WordPress

    * @subpackage Graphene

    * @since Graphene 1.1.5

    */

    get_header();

    ?>

    <h1 class=”page-title”>

    <?php

    printf(__(‘<span>%s</span>’, ‘graphene’), single_cat_title(”, false));

    ?>

    </h1>

    <?php /* The category description */

    $cat_desc = category_description();

    if ($cat_desc) : ?>

    <div class=”cat-desc”>

    <?php echo $cat_desc; ?>

    </div>

    <?php endif; ?>

    <?php

    /* Run the loop for the category page to output the posts.

    * If you want to overload this in a child theme then include a file

    * called loop-category.php and that will be used instead.

    */

    get_template_part(‘loop’, ‘category’);

    ?>

    <?php get_footer(); ?>

    In reply to: Rotating headers for ONE category?

    #19057

    To clarify where I’m stuck:

    http://juicytravels.com/blog-post-test/

    Is how I want it. See the blog header image says Blog and is the purple letters & different photo of me. And that is the actual post itself.

    But on the category archive page (which I threw you off on with my own confusion)

    http://juicytravels.com/category/juicy-travels-blog/

    It still shows the “regular rest of the site – non blog header”

    The slug for the category is juicy-travels-blog

    The images are in the folder images/custom-headers/juicy-travels-blog/

    I love about this solution that I can make numerous subject specific image header folders and plug them in…that is so perfect about it, thank you.

    But I am stuck on how to make it pull random images from say the folder /juicy-travels-blog/ for the category archive page for the category /juicy-travels/blog.

    It’s doing it for the posts = perfect.

    It’s not doing it for the category archive page….can you please help me tweak it to also show header images from the slug title folder for the category archive page?

    Pretty please? 🙂

    Thanks

    In reply to: Rotating headers for ONE category?

    #19056

    I’d really like to get this working…its so close.

    Am I missing something? I believe I implemented as you suggested so far. I’d really appreciate it if you would help me get it finished so I can move on with it…

    Thanks in advance

    In reply to: Rotating headers for ONE category?

    #19055

    Any help Syahir? 🙂

    So the only issue still is the category archive page, as you correctly pointed out earlier, is not showing images from /images/custom-headers/juicy-travels-blog

    Perhaps I missed something in your instructions?

    In reply to: Rotating headers for ONE category?

    #19054

    Syahir-

    Can you help me get this dialed in? It’s so close to being what I want it to do…

    Did I miss something in your instructions?

    In reply to: Rotating headers for ONE category?

    #19053

    Ok so getting closer…thank you so much for sticking with it!

    Category name is blog and category slug is juicy-travels-blog.

    The post called “blog post test” below is assigned to the category blog.

    http://juicytravels.com/category/juicy-travels-blog/

    NOT showing images from /images/custom-headers/juicy-travels-blog

    Rather is showing the general custom headers same as other “non blog” pages/posts

    http://juicytravels.com/blog-post-test/

    IS showing images randomly from the directory /images/custom-headers/juicy-travels-blog

    Rest of the site is showing the correct “general custom headers properly rotated as they were before. So that part is back to good.

    So the only issue still is the category archive page, as you correctly pointed out earlier, is not showing images from /images/custom-headers/juicy-travels-blog

    Perhaps I missed something in your instructions?

    Thank you!

    In reply to: Rotating headers for ONE category?

    #19051

    I was mistaken. After I cleared my cache, I see that now the entire site is displaying header images from that new images/custom-headers folder. In other words, it’s not differentiating category of blog vs the rest of the site.

    Yes, I see where you said what we are trying to nail down is randomly choosing…that part IS working perfectly, it is randomly displaying from the correct directory. SO now…just need to get it only pulling from that directory for the chosen category.

    As a follow up question:

    I want to make sub-categories of the category called “Blog”.

    I want to assign directories of images to those sub-categories.

    THANK YOU!

    In reply to: Rotating headers for ONE category?

    #19050

    Ah got, it. Thank you. And ok I will edit rather than add but I thought maybe it better to have the history there of the conversation for someone else trying to figure it out later.

    Sorry if I misunderstood you and if I wasn’t explaining it well. I think it has to do with my own confusion about blog posts vs categories vs pages etc.

    So…yes, you are absolutely correct! I do want it for the category archive page, I misunderstood you. I also want it for any posts assigned to the category blog. But I’d also like to make different directories show up for different categories, both archive page and individual posts, does that make sense?

    So what you gave me above works PERFECTLY for what I was trying to do…THANK YOU!

    Again, my apologies for being unclear…you knew exactly what I meant…I just confused myself 🙂

    So now the only question remaining is, for example, can I have another layer of granularity and have different categories pulling from different directories, like:

    images/custom-headers/skydiving

    images/custom-headers/scubadiving

    or whatever…for relative categories?

    Would I just repeat the function above with different category name + path or can I add the variety into the same function?

    Thank you again for your patience with me and your help…I really appreciate it!!

    In reply to: Rotating headers for ONE category?

    #19048

    Wait I just read the last line of your post again….

    “If that works, it will rotate the header images for *all* pages and posts in your site.

    No. I don’t want it do do all pages and posts. From the beginning of this thread my point has been…I want to be able to rotate random images from a directory of images assigned per category.

    Please let me know if this is not clear.

Viewing 10 posts - 21 through 30 (of 312 total)