saidseven 0 Report post Posted June 2, 2011 Hello, First here is my page... http://74.206.232.168/events/ I'm trying to add a row of 3 post "previews" from a specified category at the top of the page. I tried doing this via a carousel but i would like a little bit more text to show along with the thumbnail exactly like the default posts page. I tried doing it via boxes but id rather not have to make boxes manually because the event are posts already. What would be the best way to achieve this? Is there a way to insert a code snipet that will create this? Thanks in advance. Share this post Link to post Share on other sites
cmunns 16 Report post Posted June 2, 2011 I would create a custom loop. It shouldn't be too hard, but you can't addd PHP in the post editor so you'll have to use a hook Something like this as a start: ` <?php $myPosts = new WP_Query(); $myPosts->query('showposts=5'); while ($myPosts->have_posts()) : $myPosts->the_post(); ?> the_title(); the_content(); endwhile; ?> ` Share this post Link to post Share on other sites
saidseven 0 Report post Posted June 2, 2011 Thanks Adam. I went into my functions.php file and added this... function add_postpreview(){ ?> $myPosts = new WP_Query(); $myPosts->query('showposts=5'); while ($myPosts->have_posts()) : $myPosts->the_post(); ?> the_title(); the_content(); endwhile; <?php } // end function but when i preview it i get... http://74.206.232.168/events/ what am i doing wrong? Share this post Link to post Share on other sites
catrina 103 Report post Posted June 3, 2011 Where the code is placed affects whether or not it will work. Where in the editor did you place the code (below which code did you add it)? Please read the docs before posting. Please do not private message me unless I ask you to. Designer | Catrina Dulay Founder | Catrina and Mouse Share this post Link to post Share on other sites
saidseven 0 Report post Posted June 3, 2011 Hello Katrina I ended up loading a plugin called shorcode Exec PHP. Its pretty amazing in that it lets you insert php in a post page and make shortcodes. This is the actual php loop that is running at the bottom of the page. query_posts('showposts=3'); $ids = array(); while (have_posts()) : the_post(); the_title(); the_content(); endwhile; if you look on the page you can see that its showing the data twice and its staggering the layout. Is my syntax correct on my code? Share this post Link to post Share on other sites
catrina 103 Report post Posted June 3, 2011 If you have any other plugins activated, you might want to deactivate those one by one first to see if they're causing a conflict with your PHP plugin. Please read the docs before posting. Please do not private message me unless I ask you to. Designer | Catrina Dulay Founder | Catrina and Mouse Share this post Link to post Share on other sites