home page
-
I am in wordpress theme twentyten. On the home page I would like to make the center section into 2 parts. The top part being for recent posts and the bottom part for most recent sermons. I want the front page to only post 2 categories: which are Bethel News and Sermons. Is this possible without using the sidebar or the footer for this?
Thanks
Gina Tynes
https://www.bethelbentonville.com
-
Don’t edit the Twenty Ten theme. Instead create a child theme for your changes. Once your child theme is active, we should be able to help with the customisation.
I have my child theme created and it is active on my site. How do I modify the home page as I indicated in my previous note?
Thanks
Gina TynesYou can query posts from a specific category with this, put it in your page template after the id and before “if have posts” just put in the name of the page you want it to appear on, it’s conditional.
<?php if (is_page('latest')) { ?> <tr> <?php query_posts('category=uncategorized'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> <?php endif; ?> </tr> <?php } ?>
`
do I put this in the page template of the parent? when I activated my child template all I have is the style.css in editor. I’m not sure what to do here.
thanks
ginaI have to tell you that because of the child theme I’m at a bit of a loss, but I’m sure we can make it work if you want to continue allowing me to assist. Just know I’m hardly the most qualified person on the forum for this. You may want to wait around a bit for esmi to come back before forging ahead, but it’s up to you.
As a bad habit I’ve never used child themes, but reccomend that others do. In any case, I expect you would still put it in page.php. I believe what you are saying is you don’t have access to page.php because of your child theme, which only shows your style.css in the appearance editor?
Did you put it in page.php before activating the child theme? not clear on that.
Speaking of css, I’m not sure how you would style the new query, if it would inherit style and all that stuff. You may have some work ahead with making this look right.
I was told not to do any changes to the parent theme and to create the child theme to make the changes in. ESMI sent me that not a few weeks ago so now I don’t know where to go from here.
He’s right, but I don’t know about child themes, don’t understand the point. I make backup copies of all my files, If I mess up I just paste them in, If I crash a site I log on to my server and replace the files that way.
In any case, I have an interest in this too and I’m close to a solution, I currently have two sepeate category queries working on a page. I’ll offer it to you as a custom page template to use in additon to your theme’s page.php, so you won’t have to change your original code. optionaly, I’m also setting it up as a conditional in your page.php, so it only executes when on a certain page, and hides on all the others. You can do it either way. I’ll be back with it soon if you’re interested.
Here’s the code as placed between the page id and if_have_posts. It’s placed before the_title so you may want to move the_title to the top of your page template (above this custom code)
<?php if (is_page('query-posts-test')) { ?> <h3>Category6</h3>............................................................................................................. <?php query_posts('cat=6 &posts_per_page=-1') ; ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h4 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'cc' ) ?> <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></h4> <?php the_excerpt(); ?><?php echo get_the_post_thumbnail( ); ?> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query();?> </br></br></br></br> <h3>Category 7</h3>............................................................................................................ <?php query_posts('cat=7 &posts_per_page=-1') ; ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h4 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'cc' ) ?> <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></h4> <?php the_excerpt(); ?><?php echo get_the_post_thumbnail( ); ?> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query();?> <?php } ?>
I’ll be back later with a custom template, but you’ll have to adjust it as per your theme.
Also, what I did was install a plugin called “smarter navigation” it keeps categories seperated in post navigation (gets category “by referer”) this way, when someone views a full post, the navigation for next and previous posts will be limited to posts in that category. Otherwise they all run together.
one more thing, in my demo, in the posts nav, I’m showing “posted in: (category name), -that link is customized for my site, it’s hard coded to go to a certain page instead of the current post’s category. pay it no mind.
My custom page template code is displayed on the same page as my demo , it’s below the queries. Although the content area of the page could be above as well.
If you make a custom page template be sure to copy your existing page.php code into a text file, then add
<?php /* Template Name: your template name here */ ?>
just before get_header.
Place the custom query code the way I did in my template on my demo page, although you can probably put it above the_content as well. No harm in experimenting.
Then save the file as “your-template-name.php” and upload to your theme folder. The template should then be selectable from the page editor.
(“your template name” should be a name of your choosing)
Note that in my code as displayed in my demo I added an “else” statement before reseting the query, I’m still not certain that I’m doing that part right, but so far so good, even without it. Perhaps someone might chime in on that issue.
.
Here’s a new example of a site set up with two category queries on a page. Has category specific navigation with optional thumnail. Also has two column layout for the queries page, and a custom “Back to category” anchor link which links a post back to it’s category section on the queries page.
if interested I’ll share the method.
- The topic ‘home page’ is closed to new replies.