Support » Themes and Templates » Childtheme of twenty eleven – Header image slider

  • be created i,e /wp-content/uploads/2012/01 then 02,03 etc.. etc…

    I currently have in the theme folder an image/ folder and then get PHP to call the images through. I can I change it so that I can point to the uploads or to this directory as my client wants to change the image every month?

    $u= '/images/banner'; // this is the directory in the theme //
    $p= get_template_directory_uri();
    echo  "<img src=".$p."".$u."".$i."".$f.">\n";
    while ($i<8);
Viewing 4 replies - 1 through 4 (of 4 total)
  • anyone?



    Forum Moderator

    try to replace get_template_directory_uri() with a suitable get_bloginfo()


    on second thoughts – might be more complex, as you also might need to adapt the month of the upload directory and the title of the images (?)

    Upload your images to wp-content/header-images and it takes care of randomly selecting a file. You just need to make sure they’re the right size. Every month, just replace the contents of the folder.

    Firstly this will point to the twenty eleven themes folders and not the child themes folders!


    You should add the images in the child themes folder and use:

    $path = get_stylesheet_directory_uri() .'/images/banner/';

    No Code Solution (preffered option)

    as my client wants to change the image every month?

    It looks like this is not a slider as you client want to change the image monthly, as RichMacDonald has said you could just upload headers and these will change on each page load but they will not ‘slide’, or your client can upload and set the active header themself from admin.

    Using Header Images in a Slider Script:
    To return the headers to use in a slider, there is a function that will return the header images in an array so you can use them in your slider!

    // Get an array of uploaded headers
    $headers = get_uploaded_header_images();
    if( $headers ) {
    	foreach( $headers as $header ) {
    		echo  '<img src="' .$header['url'] .'" />\n"';

    Slider Plugin
    There are a number of slider plugins out there that could also be used.



Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Childtheme of twenty eleven – Header image slider’ is closed to new replies.