• Resolved goatsontheroad

    (@goatsontheroad)


    hello, I am VERY new to wordpress so hopefully somebody has the patience to assist me in my first dilemma. I desperately need each category to have it’s own picture at the top. I’m using adventure journal template, i have a dropdown menu on my home page which leads visitors to different categories, each category is a country. When they click on the country i want all blogs from that country to be displayed below. So easy enough i figured our how to do this but the problem is that i need each country category to have a panorama picture at the top of THAT country. so each category has a different picture and below that picture are all the blogs from that country.

    So, how do i change the picture at the top each different category. I have read other forums and they have described the solutions in technical terms that my newbie ears cannot process. Please help!! and help in easy to understand rookie terms step by step assuming that i know nothing of code and .css files. ANY help would be so greatly appreciated!

    my website is http://www.goatsontheroad.com

    thankyou very much

Viewing 8 replies - 1 through 8 (of 8 total)
  • Refer: WordPress conditional tag: in_category

    Which image the header or a banner image under the category title, both of these, would require you to get “under the hood” of the theme, you would need to know a little php and css it cannot be done from admin setup.

    You would need to create a child theme for your changes, create a functions.php add a function to return the image then edit category.php or header.php to display the image.

    I see you can already change the headers on pages, so you need a page of posts template added to the theme, then change to category pages in the menu.

    As the theme is a free download, if you are not comfortable in doing the changes you could consider hiring someone, or add a project on people per hour, it should not cost much at all.

    Regards

    David

    Thread Starter goatsontheroad

    (@goatsontheroad)

    Okay David, Thank-you very much for your reply. Yes i would be looking to change the Banner image on each category. I want to go “under the hood” rather than pay someone else. I need to do it myself to keep the creative juices flowing, and i NEED to learn this stuff. Anyway, i have already made a child theme. You said to make a functions.php file. I’ve searched some forums and cant figure out how to do this. I have my child theme activated but the only mention of functions.php is in my editor when i’m in my parent theme. So first things first, How do i make a new functions.php file and will it appear to the right of the editor in blue under “styles”? i would assume i need to go into /cpanel and into my themes folder and add a new file from notepad++. Should i copy the functions.php file from the parent theme? sorry… This may take time but please be patient, once i get the basics of adding code and styles i should be able to teach myself some more. I just need to get over this hump cuz as of now, code = greek to me.

    Thread Starter goatsontheroad

    (@goatsontheroad)

    okay David, i believe i successfully made the functions.php file. I looked in forums and the file says

    `<?php
    // Lets declare the name of our child theme
    $themename = “John Stamos Rules”;`

    I have no idea if this is right but i uploaded it to my child theme in /cpanel and it now appears on the right of the code text box when i go to Appearence>Editor in my child theme. Please ignore the theme name it came from extreme frustration in trying many themes.

    Am i at least on the right track?

    Hi John,

    Adventure Child Theme Files:

    The whole file here functions.php

    Search for Digital Raindrops to find the Changes in header.php

    The whole child Theme stylesheet file style.css

    And here is the Child Theme Download I created for proof of concept.

    How it works is quite simple?
    It looks to see if the post is a category post, if it is it finds the first post that has a header image (featured image), if it finds one it will return the url path and display the image.

    All you do is set a header as a featured image one of the oldest posts in each category!!

    The Function for anyone else can be fould in the links above, I will be doing the same for the Twenty Eleven theme.

    Mark this resolved it it works ok!

    HTH

    David

    If anyone is interested in this solution for twenty eleven, I have packaged it up as a downloadable twenty eleven Child Theme

    HTH

    David

    Thread Starter goatsontheroad

    (@goatsontheroad)

    You’re amazing! I’ve seen so many forums with people asking to do just this but nobody seemed to get a proper answer. This was so easy and works like a charm, i just had to change the aspect ratio of my pics (920X360) and set them to the featured image of the oldest post. Thank-you so much man this has pissed me off for a week.

    Hi,
    I did change the code slightly in the twenty ten version to find the last post in the category that was the correct width!

    if($myposts) {
    	foreach( $myposts as $catpost ) {
    		if ( has_post_thumbnail( $catpost->ID )
    			&& ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $catpost->ID ), 'post-thumbnail' ) )
    			&& $image[1] >= HEADER_IMAGE_WIDTH ) {
    				return  esc_url_raw( $image[0] );
    		}
    		return '';
    	}
    }

    HTH

    Can you mark this one as resolved please.

    David

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Make Different Header Image for Each Category’ is closed to new replies.