...

View Full Version : Wordpress: Display the page names & descriptions on homepage, not posts? (example in)



reyna12
11-13-2012, 06:43 PM
I want to achieve something like this, but showing the pages instead of posts. http://wordpress.org/extend/themes/threattocreativity

And also have an array of pre defined colours, as at the moment it just seems to do random hex codes


style="cursor:pointer;background:#<?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?>;"

Is this possible?

poyzn
11-13-2012, 07:15 PM
use get_pages (http://codex.wordpress.org/Function_Reference/get_pages) to get pages you want on a home page and then output them in a loop

reyna12
11-13-2012, 07:28 PM
Brilliant, thanks. Will give that a go.

How would i go about setting the background to instead of using a random number like in the code in original post, use a list of pre-defined colours?

poyzn
11-13-2012, 07:48 PM
Brilliant, thanks. Will give that a go.

How would i go about setting the background to instead of using a random number like in the code in original post, use a list of pre-defined colours?

What color of background do you want?

reyna12
11-13-2012, 08:05 PM
Haven't picked them out yet but various shades of orange.

poyzn
11-13-2012, 08:13 PM
define your colors in css file and then use as classes:


/* style.css */
.orange1 { background-color: #f00; }
.orange2 { background-color: #0f0; }
.orange3 { background-color: #00f; }


in layout:


<div class="orange1">...</div>

reyna12
11-13-2012, 08:22 PM
The pages are generated by an array though i think? so the
<div class="orange1"> would need to be $random?

poyzn
11-13-2012, 08:25 PM
The pages are generated by an array though i think? so the
<div class="orange1"> would need to be $random?

<div class="orange<?= rand(1,3) ?>"> ?

reyna12
11-13-2012, 08:26 PM
<div class="orange<?= rand(1,3) ?>"> ?

Thanks, will try that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum