Problems With Wordpress Theme Development - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Problems With Wordpress Theme Development (749 Views)
| Problems With Wordpress Theme Development by ace1(op): 4:53pm On Oct 24, 2012*. Modified: 8:53pm On Oct 25, 2012 |
Good day fellow Nairalanders, I'm new to WordPress theme development and I'm having problems with my home.php template page. I want to show the title, excerpt and a thumbnail of the featured image of the about page, two posts (title, Thumbnail and excerpt) from a category named events, and thumbnail images of post from a category named gallery on the home page. I've tried using the code below but still not working. I've attached a screenshot of what I'm trying to achieve Thanks ********************CODE********************** <?php query_posts('cat=2', 'posts_per_page=2'); if(have_posts()) while(have_posts()):the_post(); ?> <div class="txt"> <div class="image"> <?php $test = catch_that_image(); if(empty($test)) { ?><img src="<?php echo get_stylesheet_directory_uri().'/images/default1.jpg'; ?>"/> <?php } else {?> <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php echo get_stylesheet_directory_uri().'/lib/thumb.php'; ?>?src=<?php echo catch_that_image(); ?>&h=100&w=100&zc=1"/></a><?php } ?> </div> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <p> <?php the_content() ; ?> </p> <div class="clear"></div> </div> <?php endwhile; wp_reset_query(); ?> ********************CODE********************** |
| Re: Problems With Wordpress Theme Development by ace1(op): 9:43pm On Oct 24, 2012 |
So nobody can help me? |
| Re: Problems With Wordpress Theme Development by Nobody: 11:38pm On Oct 24, 2012 |
First of all like i said always refer to the Wordpress Codex for anything but because you are fetch from multiple categories, you will need to make use of the Wp_Query Class, in the Function Reference the code is quite explanatory, to get a thumbnail there's a function called has_thumbnail and requires the post id or you can use wp_get attachment image src. also that code is totally wrong i have never seen a Wordpress function catch_that_image. http://codex.wordpress.org/Function_Reference |
| Re: Problems With Wordpress Theme Development by Nobody: 11:38pm On Oct 24, 2012 |
using a Page and having a Template About Us is more preferable. |
| Re: Problems With Wordpress Theme Development by ace1(op): 7:06am On Oct 25, 2012 |
pc guru: First of all like i said always refer to the Wordpress Codex for anything but because you are fetch from multiple categories, you will need to make use of the Wp_Query Class, in the Function Reference the code is quite explanatory, to get a thumbnail there's a function called has_thumbnail and requires the post id or you can use wp_get attachment image src. also that code is totally wrong i have never seen a Wordpress function catch_that_image.Thanks for your reply. The catch_the_image is not a Wordpress function. Its a function I downloaded n added 2 my functions.php that gets the featured image of the post and makes it easy 4 me 2 specify the thumbnail size anytime I call d function. I'll try using the WP_Query But there's something I don't understand. If I create an about page template, how do I display it on the home? By including it? |
| Re: Problems With Wordpress Theme Development by Nobody: 10:23am On Oct 25, 2012 |
by putting this in a PHP file: <?php /* Template Name: RequestForm Page */ ?> The under the Page select template "RequestForm Page", my mail is okeowoaderemiATgmail.com, i can easily reply there. take care |
Free Wordpress Theme Development Training • Wordpress Theme Development And Plugin Development Tutorial • Having Problems With Graphcard? • 2 • 3 • 4
Website Design • Webmasters, How Many Hours Do You Sleep At Night? • Torch Browser