Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] Picture In the loop


  #1  
Old Jul 5, 2012, 06:02 AM
Björn Palovaara's Avatar
Björn Palovaara
 
12 posts · Apr 2010
Hi

In older version of Atahualpa I had a code "in the loop" for a picture on the frontpage only. I upgraded to latest version of Atahualpa and then "in the loop" disappeard. I found the index.php file and changed the code. But now this picture is shown on all pages and posts.

I want this picture only to be shown at frontpage. I can't solve it and did not save the code from the old version.

Thanks in advance!!
  #2  
Old Jul 5, 2012, 06:50 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you should add a php 'if' arround the code, something like
HTML Code:
<?php if (is_front_page()) {your image code here }; ?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Jul 9, 2012, 03:07 AM
Björn Palovaara's Avatar
Björn Palovaara
 
12 posts · Apr 2010
Hi - I don't have the php knowledge, just a barely visible scratch on the surface, if using a microscope. You see - I don't get this one right, startpage error.
I simply can't merge them two codes together, even if it looks very simple - I have tried many different ways of putting the code, this one is the latest not working code:

HTML Code:
<?php if (is_front_page()) {<img src="http://www.website.se/amazing.jpg" width="555" height="20" /> }; ?>
What is wrong?

Last edited by juggledad; Jul 9, 2012 at 03:59 AM.
  #4  
Old Jul 9, 2012, 04:06 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
when dealing with php and HTML you can't 'mix' the two, you have to let the browser know when you are 'talking' PHP and when you are talking HTML. That is why you see the '<?php' and ?>'. The '<?php' says that this is the start of some php code and the '?>' says that the php is over and now we are doing HTML, so it can get confusing if you don't know what you are doing. Here is how your line should be coded.
HTML Code:
<?php if (is_front_page()) {?> <img src="http://www.website.se/amazing.jpg" width="555" height="20" /> <?php }; ?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Jul 9, 2012, 04:44 AM
Björn Palovaara's Avatar
Björn Palovaara
 
12 posts · Apr 2010
Ahaa! Now I got it, and it is working. Many many thanks!

The best!

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Loop to "Below the Loop" stumpadelic Center area post/pages 0 Apr 28, 2011 01:23 PM
How to put picture into Byline? AJHackett Post-Kicker, -Byline & -Footer 10 Mar 7, 2011 05:07 AM
[SOLVED] How to Eliminate Previous-Next Box Between Before-Loop and Loop? LaneLester Center area post/pages 0 Nov 10, 2010 10:03 AM
Hi, new and need help with heading and picture..... droopal Installing & running WordPress 10 Apr 13, 2010 06:21 AM
picture in posts zizi Header configuration & styling 4 Apr 6, 2009 09:23 PM


All times are GMT -6. The time now is 12:53 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.