Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I bought the Hardy theme from Theme Trust thinking that the content below the home page slider would be generated by page content NOT "project" or portfolio content.

Turns out, the content below the home page slider is generated by "projects"/portfolio content. I need to make it so that all content below the home page slider is generated by page content; I've contacted Theme Trust support with no luck.

How can I make this happen? I've looked for mention of categories or similar in the index.php but didn't see anything... I'm a bit lost. Ideas?

<?php get_header(); ?>

<?php $show_full_post = of_get_option('ttrust_post_show_full'); ?>
<?php $blog_full_width = of_get_option('ttrust_post_full_width'); ?>
<?php $bw = ($blog_full_width) ? "full" : "twoThirds"; ?>

<?php if(!is_front_page()) : ?>
<div id="pageHead">
    <div class="inside">
    <?php $blog_page_id = of_get_option('ttrust_blog_page'); ?>
    <?php $blog_page = get_page($blog_page_id); ?>
    <h1><?php echo $blog_page->post_title; ?></h1>
    <?php $page_description = get_post_meta($blog_page_id, "_ttrust_page_description", true); ?>
    <?php if ($page_description) : ?>
        <p><?php echo $page_description; ?></p>
    <?php endif; ?>
    </div>
</div>
<?php endif; ?>
<div class="wrap">
<div class="middle clearfix">
<div id="content" class="<?php echo $bw; ?> clearfix">
    <div id="posts" class="cItems">         
    <?php while (have_posts()) : the_post(); ?>             
        <div <?php post_class(); ?>>                    
            <div class="inside">                                                            
                <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h2>
                <div class="meta clearfix">
                    <?php $post_show_author = of_get_option('ttrust_post_show_author'); ?>
                    <?php $post_show_date = of_get_option('ttrust_post_show_date'); ?>
                    <?php $post_show_category = of_get_option('ttrust_post_show_category'); ?>
                    <?php $post_show_comments = of_get_option('ttrust_post_show_comments'); ?>

                    <?php if($post_show_author || $post_show_date || $post_show_category){ _e('Posted ', 'themetrust'); } ?>                    
                    <?php if($post_show_author) { _e('by ', 'themetrust'); the_author_posts_link(); }?>
                    <?php if($post_show_date) { _e('on', 'themetrust'); ?> <?php the_time( 'M j, Y' ); } ?>
                    <?php if($post_show_category) { _e('in', 'themetrust'); ?> <?php the_category(', '); } ?>
                    <?php if(($post_show_author || $post_show_date || $post_show_category) && $post_show_comments){ echo " | "; } ?>

                    <?php if($post_show_comments) : ?>
                        <a href="<?php comments_link(); ?>"><?php comments_number(__('No Comments', 'themetrust'), __('One Comment', 'themetrust'), __('% Comments', 'themetrust')); ?></a>
                    <?php endif; ?>
                </div>                      

                <?php if($show_full_post) : ?>
                    <?php the_content(); ?>
                <?php else: ?>

                    <?php if(has_post_thumbnail()) : ?>
                        <?php if(of_get_option('ttrust_post_featured_img_size')=="large") : ?>                                          
                            <a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail('ttrust_post_thumb_big', array('class' => 'postThumb', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?></a>               
                        <?php else: ?>
                            <a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_post_thumbnail('ttrust_post_thumb_small', array('class' => 'postThumb alignleft', 'alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?></a>
                        <?php endif; ?>
                    <?php endif; ?>         
                    <?php the_excerpt(); ?>
                    <?php more_link(); ?>                   

                <?php endif; ?>         
            </div>                                                                              
        </div>              

    <?php endwhile; ?>

    </div>
    <?php global $total_pages; $total_pages = ceil($wp_query->found_posts/get_option('posts_per_page')); ?>
    <?php $paged = get_query_var('paged'); ?>
    <?php get_template_part( 'part-pagination'); ?> 
</div>


<?php if($bw == "twoThirds") get_sidebar(); ?>              
</div>
</div>

<?php get_footer(); ?>
share|improve this question
1  
If you paid for a theme I would recommend you contact the developer and ask for the changes. This is something called "after sales". –  Waldermort Sep 10 '13 at 19:10
    
@Waldermort That was the first thing I tried; was informed it was beyond the scope of their support services. –  user1255049 Sep 10 '13 at 19:17
    
That's the culprit: You can't expect support to also do your customization. You'll need to hire a developer for that. Posting "do this job for me for free" is off topic per the sites FAQ. See the help center. –  kaiser Sep 10 '13 at 19:46
    
@kaiser I apologize if I came off as wanting the work done for free. I attempted this myself first, per the FAQ, and after not quite understanding what to do I decided to ask here for help(eg, the question at the end of my post). –  user1255049 Sep 10 '13 at 20:12
    
Well, after a look at the demo source code, I can just say that what you showed above can't be the code that generates the demo page. Sorry, but after asking 55 questions like this, I can only recommend you to finally learn PHP. You won't get around that and spending a weekend with learning will save you and us a great amount of time. WP.SE simply isn't the place to go and outsource your work :) –  kaiser Sep 10 '13 at 20:22
add comment

1 Answer 1

All you need to do is place a query in front of this line:

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

A query can be used to get posts from a specific type, category, tag or taxonomy.

An example would be:

<?php query_posts('category_name=category'); ?>
 <?php while (have_posts()) : the_post(); ?>

Using query_posts() can have it's drawbacks such as slightly slower load times.

I forgot to mention that you should reset the query after using it. So somewhere after

<?php endwhile; ?>

use:

<?php wp_reset_query(); ?>

That will reset the main query.

Otherwise you could use the WP_query here http://codex.wordpress.org/Class_Reference/WP_Query

But you will need to modify your loop to make it work.

You can visit the codex to learn more about post queries.
http://codex.wordpress.org/Function_Reference/wp_reset_query

share|improve this answer
    
That's sort of what I was thinking needed to happen, I just didn't know where to begin. If I'm understanding you and the Codex correctly, after implementing that code, I can use a "home category" to generate all home content, while still having portfolio projects post to the portfolio page(because it's a separate template)? –  user1255049 Sep 10 '13 at 20:14
1  
Please don't recommend query_posts(), as it's altering the main query and disconnecting the globals $wp_query and $wp_the_query. –  kaiser Sep 10 '13 at 20:17
    
It's no different than using it on any other page. What's the point of having a query posts if you can't use it. All you have to do is reset the query when your done. I don't see the reason for the down vote when it works and answers the question. The OP only wants to show those certain posts on that page. –  Jacob Rambo Sep 10 '13 at 20:31
    
In any case if the OP reads the codex on the page I sent them they will have plenty of options for making this happen. –  Jacob Rambo Sep 10 '13 at 20:37
    
Jacob, our sites second most upvoted answer will explain it better than a comment. Aside from that, query_posts() is an internal function, only meant to be used by core. I know, it's not really obvious. Updated Codex for that reason. –  kaiser Sep 10 '13 at 21:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.