emtb Posted July 19, 2008 Share Posted July 19, 2008 Afternoon all, Wonder if you could help me with a php problem. I am using a Wordpress Theme and in the index.php I have the following line of code that I just can't see what's wrong with it. Overview. The theme displays 4 images, called featured1.jpg to featured4.jpg Each image is related to how many post there are - so 3 posts = 3 images. The php code in question is highlighted in bold The php code I know is correct is underlined <!--Using offset to show the last differing DIV containing the fourth post in the Featured category--> <?php query_posts('category_name=featured&showposts=1&offset=3'); while (have_posts()) : the_post(); ?> <div class="box last"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/featured/<?php // this is where the custom field prints images for each Feature $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="Copyright: www.emarketerstoolbox.co.uk" style="border: #fff 4px solid; padding: 1px; margin: 5px 0px 5px 0px;" /></a><a href="<?php the_permalink() ?>" rel="bookmark" class="title"> <?php // this is where title of the Feature gets printed the_title(); ?> »</a> <div id="separator"></div> <small class="title">Posted on <?php the_date_xml(); ?> by <?php the_author_posts_link(); ?></small> </div> <?php endwhile; ?> So the part that is correct : <img src="<?php bloginfo('template_url'); ?>/featured/<?php bloginfo = http://emarketerstoolbox.co.uk template_url = wp-newsmag /featured/ = the directory that the images are stored in Now this all works fine, but the bold part of the code is where it is supposed to work out the final part of the eventual URL which should look like this: http://emarketerstoolbox.co.uk/wp-newsmag/featured/featured1.jpg But it doesn't. Can anybody point me in the right direction?? The theme when it works properly can be seen here http://news.wp-magazine.se/ I've emailed the developer of the theme, but not had an answer back, and I could do with getting it sorted this weekend while I have some time. And if you need any more info, please ask away Thanks in advance Toby Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/ Share on other sites More sharing options...
emtb Posted July 19, 2008 Author Share Posted July 19, 2008 Forgot to mention a few comments he made on his website that may be of help Using Custom Fields For the front page loop images in the five featured sections (categories) WP NewsMag uses Custom Fields. The key should be set to “Image” (without the citation characters and with a capital “I”) for the larger images and “Small” for the smaller images and the value is simply the name of your image. Like this: Key: Image and Value: name-of-image.jpg. (Key: “Small” for the smaller ones.) The pictures should be uploaded to the folder “featured” in the WP NewsMag template folder. If you want your images elsewhere you need to change the paths in each of the five featured boxes in the index.php file. Find this: bloginfo(’template_url’); ?>/featured/ and change to whatever place you like on your server. Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-594314 Share on other sites More sharing options...
emtb Posted July 19, 2008 Author Share Posted July 19, 2008 Anyone!! :-) Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-594431 Share on other sites More sharing options...
marklarah Posted July 19, 2008 Share Posted July 19, 2008 use the [code ] tags Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-594440 Share on other sites More sharing options...
emtb Posted July 20, 2008 Author Share Posted July 20, 2008 Thanks Mark - whereabouts. I'm fairly new to php so my knowledge is limited Thanks Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-594701 Share on other sites More sharing options...
emtb Posted July 21, 2008 Author Share Posted July 21, 2008 LOL sorry Mark, just realised what you meant Afternoon all, Wonder if you could help me with a php problem. I am using a Wordpress Theme and in the index.php I have the following line of code that I just can't see what's wrong with it. Overview. The theme displays 4 images, called featured1.jpg to featured4.jpg Each image is related to how many post there are - so 3 posts = 3 images. The php code in question is highlighted in bold The php code I know is correct is underlined [u]<!--Using offset to show the last differing DIV containing the fourth post in the Featured category--> <?php query_posts('category_name=featured&showposts=1&offset=3'); while (have_posts()) : the_post(); ?> <div class="box last"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/featured/<?php[/u] [b]// this is where the custom field prints images for each Feature $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="Copyright: www.emarketerstoolbox.co.uk" style="border: #fff 4px solid; padding: 1px; margin: 5px 0px 5px 0px;" /></a><a href="<?php the_permalink() ?>" rel="bookmark" class="title"> <?php // this is where title of the Feature gets printed the_title(); ?> »</a> <div id="separator"></div> <small class="title">Posted on <?php the_date_xml(); ?> by <?php the_author_posts_link(); ?></small> </div> <?php endwhile; ?> [/b] So the part that is correct : <img src="<?php bloginfo('template_url'); ?>/featured/<?php bloginfo = http://emarketerstoolbox.co.uk template_url = wp-newsmag /featured/ = the directory that the images are stored in Now this all works fine, but the bold part of the code is where it is supposed to work out the final part of the eventual URL which should look like this: http://emarketerstoolbox.co.uk/wp-newsmag/featured/featured1.jpg But it doesn't. Can anybody point me in the right direction?? The theme when it works properly can be seen here http://news.wp-magazine.se/ I've emailed the developer of the theme, but not had an answer back, and I could do with getting it sorted this weekend while I have some time. And if you need any more info, please ask away Thanks in advance Toby Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-595322 Share on other sites More sharing options...
emtb Posted July 21, 2008 Author Share Posted July 21, 2008 Solved it - to do with Custom Fields Link to comment https://forums.phpfreaks.com/topic/115609-solved-php-in-a-wordpress-theme/#findComment-595904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.