Member Login

You are not currently logged in.






» Register
» Lost your Password?

Display posts on static page | Thesis PHP | Forum

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

For a Limited Time Only

Join our Community for as little as
$0.43 PER DAY!
THIS OFFER EXPIRES May 31st!


 
You must be logged in to post


Lost Your Password?

Search Forums:


 






Minimum search word length is 4 characters – Maximum search word length is 84 characters
Wildcard Usage:
*  matches any number of characters    %  matches exactly one character

Display posts on static page

No Tags
UserPost

1:21 am
February 22, 2012


Stephen B

Jedi

posts 53

1

Hi Rick,

 

I was following one of your tutorials as I was wanting to get some posts on my front page.

The tutorial was: Custom Front Page Loop that Displays One Post from Each Category

 

However, I have tried several different things with the code, but for some reason it prints the first post teaser from each category… PLUS the entire post content for the final post.

 

Are you able to help me with this code. I have been stuck on it all day and night.

Here is the code. I have been toying around with it a bit just to see what happens, so it is not quite as described in the tutorial, but saves you searching for it:

 

function byob_front_page_template() {
    if(is_front_page()) {
        $byob_categories = array('19','21');
        $category_args = array( 'include' => $byob_categories);
        
        $categories = get_categories ( $category_args );
        
        foreach ($categories as $category) {
            $byob_category_instance = $category->cat_ID;
            $byob_category_label = $category->name;
            
            $args = array('posts_per_page' => '1',
                'category__in' => $byob_category_instance);
                
        $my_query = new WP_Query($args);
        while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;
        //    echo '<h4>' . $byob_category_label . '</h4>';
        
        echo thesis_teaser($classes, $post_count, $right);
        endwhile;
        }
    }
}
remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
add_action('thesis_hook_before_post', 'byob_front_page_template');

 

Also, in this type of loop, how would I get the default html structure surrounding my teasers. At the moment, they are obviously quite different due to the css classes.

 

Much appreciated

Steve

10:56 am
February 22, 2012


Stephen B

Jedi

posts 53

2

Hi Rick,

 

Regarding the above… I am wanting to get post TEASERS on my front page.

 

Thanks

4:37 pm
February 22, 2012


Rick Anderson

Edmonds, WA

Admin

posts 3156

3

Stephen I'll work on this tomorrow morning.  My one suggestion would be to add the function wp_reset_query() after the endwhile.

I confess that I am having some loop issues myself that I suspect are related to Thesis with WordPress 3.3.  However I haven't been able to track the issue down.  I"ll see what I can do tomorrow.

The codex article on wp_reset_query() might help - http://codex.wordpress.org/Fun…..eset_query

5:08 pm
February 23, 2012


Stephen B

Jedi

posts 53

4

Thanks for the assistance Rick.

 

I will try your suggestion.

6:03 pm
February 23, 2012


Stephen B

Jedi

posts 53

5

Hi Rick,

 

I tried your suggestion of using wp_reset_query() after the endwhile which brought me one step closer to success:)

 

* I no longer get the full content of the last post displaying.

* I'm only getting one post teaser displaying (in total)

* I'm still losing the styling of the post teaser and it's actually mixing in with the post rather than displaying before it (which is possibly just an html/css issue)

 

Wouldn't you think that in a blogcentric platform like Wordpress, there would be lots of quick and easy built in ways to display post teasers on static pages? Or maybe I just want too much:)

12:11 am
April 9, 2012


Svein Gullby

Member

posts 33

6

I need this functionality too on one of my sites. Does anyone know if there's been updated a video transcript which describes how to do this?

10:10 am
April 10, 2012


Rick Anderson

Edmonds, WA

Admin

posts 3156

7

Svein, have you worked through the tutorial?  If so, is something not working properly?

No Tags


About the Build Your Own Business Website Forum

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 38

Currently Online:
11 Guests

Currently Browsing this Topic:
1 Guest

Forum Stats:

Groups: 7
Forums: 40
Topics: 1646
Posts: 7185

Membership:

There are 2365 Members
There have been 3 Guests

There is 1 Admin
There are 2 Moderators

Top Posters:

Brian Tozer – 400
Reece Morrel – 285
Rachel McFadden – 143
Jackie Jacobson – 140
steve Whitehead – 134
Catherine Mulhern – 130

Recent New Members: Francisco Mogollon, amember, Tim Frisch, kay ache, Harold Goldsmith, Todd Wilson

Administrators: Rick Anderson (3156 Posts)

Moderators: Gelie Laxamana (15 Posts), Jorene Abapo (0 Posts)