Cutline Theme Support Forums » Cutline Theme Support Forums

How do I make the header images become random?

(4 posts)
  • Started 4 years ago by templehaiticlubcom
  • Latest reply from psychologycareers
  • This topic is not resolved

  1. What do I have to add or modify? I just want it to be random no matter what page is up, whether it be home, page, archives, single post, I just want it to be random whenever. I may not be searching the right places, but I can't seem to find it. I have the latest version of wordpress and cutline theme 2.1

    Thanks!

    Here is my header.php:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    <title><?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('name'); echo(' — '); bloginfo('description'); } ?></title>

    <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/custom.css" type="text/css" media="screen" />
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/ie7.css" media="screen" />
    <![endif]-->
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/ie6.css" media="screen" />
    <![endif]-->
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

    <?php wp_head(); ?>
    </head>
    <body class="custom">

    <div id="container">

    <div id="masthead">
    <h1>"><?php bloginfo('name'); ?></h1>
    <h3><?php bloginfo('description'); ?></h3>
    </div>

    <ul id="nav">

  2. Home
  3. href="<?php bloginfo('url'); ?>">front news page
  4. href="<?php bloginfo('url'); ?>/archives/">archives
  5. href="<?php bloginfo('url'); ?>/about/">about
  6. <li class="rss">">RSS

  7. Haiti Club Photos
  8. <div id="header_img">
    <?php if (is_home()) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/header_1.jpg" width="770px" height="140px" alt="<?php bloginfo('name'); ?> header image 1" title="<?php bloginfo('name'); ?> header image 1" />
    <?php } elseif (is_single()) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/header_2.jpg" width="770"px height="140px" alt="<?php bloginfo('name'); ?> header image 2" title="<?php bloginfo('name'); ?> header image 2" />
    <?php } elseif (is_page()) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/header_3.jpg" width="770px" height="140px" alt="<?php bloginfo('name'); ?> header image 3" title="<?php bloginfo('name'); ?> header image 3" />
    <?php } elseif (is_archive()) { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/header_4.jpg" width="770px" height="140px" alt="<?php bloginfo('name'); ?> header image 4" title="<?php bloginfo('name'); ?> header image 4" />
    <?php } else { ?>
    <img src="<?php bloginfo('template_url'); ?>/images/header_5.jpg" width="770px" height="140px" alt="<?php bloginfo('name'); ?> header image 5" title="<?php bloginfo('name'); ?> header image 5" />
    <?php } ?>
    </div>

Posted 4 years ago #
  • couchmouse
    Member

    change the width and height to the size images your are using.

    <div id="header_img">
    <img src="<?php bloginfo('template_url'); ?>/images/header_<?php echo(rand(1,7)); ?>.jpg" width="900" height="150" alt="<?php bloginfo('name'); ?> random header image" title="<?php bloginfo('name'); ?> random header image" />
    </div>

    if you want an image to stay the same for a specific page but rotate for the other pages follow this example. change for your website

    <div id="header_img">
    <?php if (is_page('about')) { ?>
    <img src="http://couchmouse.net/wp-content/themes/Cutline/images/header_2.jpg" width="900" height="150" alt="Couchmouses' Corner about page header image" title="Couchmouses' Corner about page header image" />
    <?php } else { ?>
    <img src="http://couchmouse.net/wp-content/themes/Cutline/images/header_<?php echo(rand(1,8)); ?>.jpg" width="900" height="150" alt="Couchmouses' Corner random header image" title="Couchmouses' Corner random header image" />
    <?php } ?>
    </div>

    Posted 4 years ago #
  • webseo67
    Member

    if you want an image to stay the same for a specific page but rotate for the other pages follow this example. change for your websitebeauty products

    Posted 1 year ago #
  • psychologycareers
    Member

    What do I have to add or modify? I just want it to be random no matter what page is up, whether it be home, page, archives, single post,
    psychology careers

    Posted 11 months ago #

  • RSS feed for this topic

    Reply

    You must log in to post.