WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Platform theme: problem showing a image in sidebar (15 posts)

  1. marcie73
    Member
    Posted 3 years ago #

    Hello to everyone,
    I'm using platform theme and I set a 3 column layout (one sidebar left + one sidebar right). I also added a image in top of the sidebars in sidebar.php. In most pages I have choosed a 2 column layout hiding the right sidebar and my image shows up at the top as I set it. But when I choose to show both sidebars the image disappears, why?
    I'n not familiar with php and I don't undestand what the code exactly says, please anyone can help me?
    I post the code so you can have a look through it. thanks a lot!

    <?php
    /*
    
    	SIDEBAR (SIDEBAR WRAP)
    
    	This file controls the sidebar wrap template; which depending on the mode container one or both sidebars from layout.
    	(It is used by BuddyPress as well and should play nice with child themes.)
    
    	This theme copyright (C) 2008-2010 PageLines
    
    */
    pagelines_register_hook('pagelines_before_sidebar_wrap'); // hook
    global $pagelines_layout;
    
    if($pagelines_layout->layout_mode != 'fullwidth'):?>
    
    	<div id="sidebar-wrap" class="fix">
    
    <?php
    			if(pagelines_option('sidebar_wrap_widgets') == 'top' || !pagelines_option('sidebar_wrap_widgets')){
    				pagelines_template_area('pagelines_sidebar_wrap', 'sidebar_wrap'); // hook
    			}
    
    		if($pagelines_layout->layout_mode != 'two-sidebar-center'):?>
    			<div id="sidebar1" class="scolumn fix" >
    <img src="http://www.gaia-gelatoecobio.com/Gaia/wp-content/uploads/gaia.png" width="153" height="84" alt="GAIA" border=0 />
    				<div class="scolumn-pad">
    					<?php pagelines_template_area('pagelines_sidebar1', 'sidebar1'); // hook ?>
    				</div>
    			</div>
    		<?php endif;
    
    		if($pagelines_layout->num_columns == 3): ?>
    			<div id="sidebar2" class="scolumn fix">
    <img src="http://www.gaia-gelatoecobio.com/Gaia/wp-content/uploads/gaiablog.png" width="227" height="67" alt="GAIABLOG" border=0 />
    				<div class="scolumn-pad">
    					<?php pagelines_template_area('pagelines_sidebar2', 'sidebar2'); // hook ?>
    				</div>
    			</div>
    <?php 	endif;
    
    			if(pagelines_option('sidebar_wrap_widgets') == 'bottom'){
    				pagelines_template_area('pagelines_sidebar_wrap', 'sidebar_wrap'); // hook
    			}
    
    		?>
    	</div>
    <?php
    endif;
    
    pagelines_register_hook('pagelines_after_sidebar_wrap'); // hook
  2. peredur
    Member
    Posted 3 years ago #

    Somebody may be familiar with this and be able to help you straightaway, but I might be able to if you post a URL to your site so I can compare the code between the 2 and 3 column layouts. It'll help me to see what the code's doing.

    Cheers

    PAE

  3. marcie73
    Member
    Posted 3 years ago #

    Thank you peredur for your answer.
    This is the site:
    http://www.gaia-gelatoecobio.com/Gaia/
    All the pages have 2 columns with left sidebar.

    For the blog part I have used the 3 column layout, with sidebar for each side.
    http://www.gaia-gelatoecobio.com/Gaia/?p=431
    As you can see the logo "Gaia" is no there anymore.

    Hope this can help.
    Marzia

  4. peredur
    Member
    Posted 3 years ago #

    There are one or two things that don't quite add up for me here.

    Firstly, your code starts:

    if($pagelines_layout->layout_mode != 'fullwidth'):?>

    This kinda suggests that the code inside the if statement will only be executed if the layout is not full width. Yet the HTML seems to suggest that the layout **is** full width; or at least the body element contains a class called full_width for both 2 and 3 column layouts.

    And, in fact, if you look at the HTML output for the 3 column layout, you find that this is not output:

    <div id="sidebar-wrap" class="fix">

    Which means that the condition did, indeed, fail in the case of the 3 column layout and the code in the if statement was not executed. Which is why the image is not showing.

    Secondly, the internal if statement in which you have your img element says:

    if($pagelines_layout->layout_mode != 'two-sidebar-center'):?>

    This suggests that the image will display when it's **not** a two sidebar centered layout. However, the time when the image does display is when it **is** a two sidebar centered display.

    All very confusing.

    Is there some other code somewhere that I ought to be looking at? Something that says what should happen when it is a full width display?

    Cheers

    PAE

  5. marcie73
    Member
    Posted 3 years ago #

    Thank you peredur,
    here you can download all the php files where the word "fullwidth" was found.
    http://www.gaia-gelatoecobio.com/filesphp.zip
    Hope that in one of them will be found what you are looking for.
    Thank you again for your time.
    Marzia

  6. marcie73
    Member
    Posted 3 years ago #

    In the maintime I read 3 times...I don't understand here where you say:
    "However, the time when the image does display is when it **is** a two sidebar centered display."
    The image DOESN'T display when its a two sidebar centered display.
    I mean the logo Gaia at the left (not GAIABLOG at the right).
    Or maybe I misunderstood...

  7. peredur
    Member
    Posted 3 years ago #

    For me, the gaia.png displays on the page http://www.gaia-gelatoecobio.com/Gaia/, which is a 2 column display and doesn't display on the http://www.gaia-gelatoecobio.com/Gaia/?p=431 page which is a 3 column display. On the 3 column display, the image gaiablog.png displays (in the right hand sidebar.

    BTW, I think your gaiablog.png should be replaced with text. Much more screen-reader friendly.

    Cheers

    PAE

  8. marcie73
    Member
    Posted 3 years ago #

    yes, what you described is what happen and what we can see, but what I need is the logo gaia.png to be shown in the 3 column display as well.
    Have you find anything helpful in the zip folder?
    Thank you again

    ps: yes I agree to make gaia blog more screen reader frinedly.But I can even get rid of it...
    Cheers!

  9. peredur
    Member
    Posted 3 years ago #

    OK. I think we understand the same thing. Maybe I didn't explain myself very well. It is a bit confusing.

    Here's what I think is going on, after sifting through the files you sent and checking out the HTML output. When you are in 2 column mode, the element that contains your gaia.png image is "the sidebar".

    When you are in 3 column mode the element that contains the other image is "the sidebar" and the other element that **looks** like a sidebar (on the left) is actually a part of the content. So it's being output from somewhere else.

    We need to find the file (or files) that output(s) the element:

    <div id="column-wrap" class="fix">

    That's the element that contains the left "sidebar" in the 3 column display. If we can find that, we can add the img element to it and everything should work. I hope.

    Cheers

    PAE

  10. marcie73
    Member
    Posted 3 years ago #

    i found "column-wrap" in 2 files, here you can download them:
    http://www.gaia-gelatoecobio.com/filesphp2.zip
    I tried to add the image in template.content.php (see the child in the folder) and actually it shows up in 3 column display, but it also shows up in the middle content in the other pages with 2 column layout!! You can see now it is there twice.
    Should I have to put the html of the image somewhere else?
    Thank you again!
    Marzia

  11. peredur
    Member
    Posted 3 years ago #

    Hi Marzia,

    I'm struggling a bit here, but when did that ever stop me!

    Looking at the code you posted, I think the image should go here:

    <div id="sidebar1" class="scolumn fix">
      <div class="scolumn-pad">
    
        <!-- I think the image should go here -->
    
        <?php pagelines_template_area('pagelines_sidebar1', 'sidebar1'); ?>
      </div>
    </div>

    See how that turns out. You'll need to take it out of the place you already put it, of course.

    Cheers

    PAE

  12. peredur
    Member
    Posted 3 years ago #

    Yep. Just had a bit of a better look. I think what I posted above is OK, but a better place might be immediately before the line:

    <div id="sidebar1" class="scolumn fix">

    You'll need to make sure, of course that this is the only place it goes. So you'll have to take it out of the sidebar (sidebar1, that is), for instance if you've still got it in there.

    What's happening when you add it immediately into the column-wrap div is that the main content on a two-column layout is wrapped in one of those.

    Anyway, give it a go. If the positioning is still a bit out don't worry about that, we can sort that with CSS.

    Cheers

    PAE

  13. marcie73
    Member
    Posted 3 years ago #

    Yes, I put it positioned imediately before sidebar1, as you told me, and....wow, it's working!!!!!
    And actually it's also working after
    <div id="sidebar1" class="scolumn fix">
    because I realised that piece of code inside the div is exactly the same as the one in sidebar.php (the one managing the 2 column display).
    How it's nice that forums exist and people like you willing to help as well!
    Many, many, many thanks peredur!!! :-)
    Have a good day!
    Marzia

  14. peredur
    Member
    Posted 3 years ago #

    Glad it worked out Marzia. If you could mark the topic resolved, it would help other people who may search the list for similar solutions.

    Cheers

    PAE

  15. marcie73
    Member
    Posted 3 years ago #

    yes, I will!
    cheers :-)

Topic Closed

This topic has been closed to new replies.

About this Topic