Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Changing Imbalance theme home page WordPress

  • SOLVED

I would like to do a few things to my site www.studio223design.com.

Firstly, I'd like to have the home page be a "static" page. Currently, I have inserted the content you see above "Our Work | Our Thoughts" in the index page. I just like to see the content above that line be displayed. Also, I'd like to have that quote in the sidebar in that section rotate. I know there are plugin that can do this but I don't know how to make it so there is real sidebar over there where I can install the widget for that "effect". I'd also like to be able to edit the content of this div in the back-end of wordpress.

Next I'd like to have a separate blog page to house all my blog articles.

I think that's it.

Answers (4)

2010-10-27

Baki Goxhaj answers:

You need to create a home.php and add content there. You can add static content, or create loops to query content automatically from pages and/or posts you like.

***

To create a separate blog page, create blog.php and add this in the beginning of PHP:
/*
Template Name: Blog
*/


After you do so, create a page in the backend, name it whatever you like (most likely Blog) and attach the template we created earlier to it in the Page Template section. You will have some pagination problems, so you need to hack a little the query there, on the blog.php page. This is the code:
<strong>
Find this:</strong>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<strong>
Replace with:</strong>

<?php if (have_posts()) : ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("posts_per_page=10&paged=$paged"); ?>
<?php while (have_posts()) : the_post(); ?>


***

To create a widgitized section get his code and paste it in your functions.php:


register_sidebar( array(
'name' => 'Quote',
'before_widget' => '<div id="quote" class="%2$s">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
) );


Than paste the code below where the actual quote is on homepage (or index.php, as you said):

<?php dynamic_sidebar('Quote'); ?>

After that you will be able to drop widgets in the Quote sidebar that will show up in your Appearance => Widgets section.

Let me know for anything unclear.




Jorge Gonzalez comments:

Man, I don't really get it at all.

So I create a file called home.php? What goes in that file? Just my html content? I don't have any php whatsoever in what I created on the index page so how does that home.php talk to the index page? Or does it talk to it simply by virtue of its name: home.php?

now, what exactly, goes in the blog page? you wrote

<blockquote>After you do so, create a page in the backend, name it whatever you like (most likely Blog) and attach the template we created earlier to it in the Page Template section. You will have some pagination problems, so you need to hack a little the query there, on the blog.php page</blockquote>.

after I do what? create the blog.php? and what template am i attaching and how? what is the page template section? and what are pagination problems?

Help me figure that out first...then we'll move onto the other stuff cause none of this is very clear to me yet.




Baki Goxhaj comments:

Copy page.php or single.php and rename it blog.php, than start editing. Also, copy index.php and name it home.php. If you have an archive.php, than just go on working on your index.php in stead of creating an home.php.


Jorge Gonzalez comments:

All right. I've created the home.php page. Here is the code:

<?php get_header(); ?>
<div id="homeContent">
<div id="studioIs">
<h2>Studio 223 is...</h2>
<p>...a design shop, think tank, conceptatorium. Graphic design, web design, colors, paper, typefaces &#8212; those are just the mediums through which a concept is conveyed. We're interested in the real hard part of this: the branding, the positioning, the strategy of your brand; creating a concept that can help your business not just look different but actually be different.</p> <p> Ask yourself "What, <em>really,</em> is my business, and how, <em>really,</em> do I get my market to connect with me?" Do you know the answer? No, really, <em>do you know the answer?</em> More importantly, <strong>do your customers know the answer?</strong> Read that again. <a href="http://www.studio223design.com/contact-studio-223">Ready to get started?</a></p>
<h2>Studio 223 does...</h2>
<p>...graphic design, print design and web design for small businesses. We're interested in creating an idea that people can connect to and then designing around that idea. We believe in providing an experience to your customers through different media whether it be original photography, custom brochures, an intelligent logo or a refreshingly simple website experience.</p> <p>Ask yourself whether currently your customers are experiencing something new when interacting with your brand. What is their gut feeling about you? Do you know? Now are you<a href="http://www.studio223design.com/contact-studio-223"> ready to get started?</a> </p>
</div>
<div id="quote">
<p>"If your brand suddenly didn't exist, would anyone miss it? A really good brand leaves a big gap."<br/> <small>Juan Pablo Ramirez</small></p>
</div>

</div>
<?php get_footer(); ?>


But as I stated in my initial post, I'd like to be able to change this content in wordpress' back-end. How do I accomplish this?

I guess we'll have to take it one step at a time here.


Baki Goxhaj comments:

Create a page, name it Home (exclude it from navigation) and add the actual content in it. After that, add this code to your home.php:


<?php get_header(); ?>

<div id="homeContent">

<?php query_posts('pagename=home'); while (have_posts()) : the_post(); ?>

<div id="studioIs">

<h2><?php the_title(); ?></h2>

<?php the_content(); ?>

</div>

<?php endwhile; ?>

<?php dynamic_content('Quote'); ?>


</div>

<?php get_footer(); ?>


Jorge Gonzalez comments:

Ok. I'm starting to understand now. Let's talk about the widgetized sidebar section. Right now it's throwing an error. Presumably because I haven't added that code snippet above to my functions.php file? Ok. Where in that file do I add that code snippet?


Baki Goxhaj comments:

At the end of the file.


Jorge Gonzalez comments:

ok. I have followed your instructions thus far and I'm getting an error.

<blockquote>Fatal error: Call to undefined function dynamic_content() in /home2/studipe0/public_html/wp-content/themes/imbalance/home.php on line 9</blockquote>

I looked at line 9 and this is what it is:

<?php dynamic_content('Quote'); ?>


What's this error?


Baki Goxhaj comments:

Sorry, replace with:

<?php dynamic_sidebar('Quote'); ?>


Jorge Gonzalez comments:

Awesome. That's working swimmingly.

Now, How do I get my blog to display? The index.php file has the loop for the blog running through it and there is also a blog.php file that has identical content. What do I do?


Baki Goxhaj comments:

Show me your blog.php file and I will edit it for you - as we did for home.php.


Jorge Gonzalez comments:

<?php
/*
Template Name: Blog page
*/
get_header(); ?>

<ul class="mcol">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<li class="article" id="post-<?php the_ID(); ?>">

<?php
if ( has_post_thumbnail() ) { ?>
<?php
$imgsrcparam = array(
'alt' => trim(strip_tags( $post->post_excerpt )),
'title' => trim(strip_tags( $post->post_title )),
);
$thumbID = get_the_post_thumbnail( $post->ID, 'background', $imgsrcparam ); ?>
<div class="preview"><a href="<?php the_permalink() ?>"><?php echo "$thumbID"; ?></a></div>

<?php } else {?>
<div class="preview"><a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/images/default-thumbnail.jpg" alt="<?php the_title(); ?>" /></a></div>
<?php } ?>

<div class="article-over">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<div class="postmetadata">
Posted: <?php the_time(__('F jS, Y', 'kubrick')) ?>&nbsp;&#721;&nbsp;
<?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed') ); ?><br />
<?php printf(__('Filled under: %s'), get_the_category_list(', ')); ?>
</div>
</div>
</li> <?php ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</ul>

<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<h1 id="error"><?php _e("Sorry, but you are looking for something that isn&#8217;t here."); ?></h1>
<?php endif; ?>


<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>

<?php get_footer(); ?>


Baki Goxhaj comments:

You need to:

1. Paste the code below in blog.php;
2. Create a page and name it Blog or whatever you like;
2. Assign the "Blog" template to your page - see attached image for reference.

<strong>The code:</strong>

<?php

/*

Template Name: Blog

*/

get_header(); ?>


<ul class="mcol">

<?php if (have_posts()) : ?>
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("posts_per_page=10&paged=$paged"); ?>
<?php while (have_posts()) : the_post(); ?>


<li class="article" id="post-<?php the_ID(); ?>">



<?php

if ( has_post_thumbnail() ) { ?>

<?php

$imgsrcparam = array(

'alt' => trim(strip_tags( $post->post_excerpt )),

'title' => trim(strip_tags( $post->post_title )),

);

$thumbID = get_the_post_thumbnail( $post->ID, 'background', $imgsrcparam ); ?>

<div class="preview"><a href="<?php the_permalink() ?>"><?php echo "$thumbID"; ?></a></div>



<?php } else {?>

<div class="preview"><a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_url'); ?>/images/default-thumbnail.jpg" alt="<?php the_title(); ?>" /></a></div>

<?php } ?>



<div class="article-over">

<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>

<?php the_excerpt(); ?>

<div class="postmetadata">

Posted: <?php the_time(__('F jS, Y', 'kubrick')) ?>&nbsp;&#721;&nbsp;

<?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed') ); ?><br />

<?php printf(__('Filled under: %s'), get_the_category_list(', ')); ?>

</div>

</div>

</li> <?php ?>

<?php endwhile; ?>

<?php else : ?>

<?php endif; ?>

</ul>



<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

<?php endwhile; ?>

<?php else : ?>

<h1 id="error"><?php _e("Sorry, but you are looking for something that isn&#8217;t here."); ?></h1>

<?php endif; ?>


<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>


<?php get_footer(); ?>