WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] space above widgets only in pages (10 posts)

  1. connectto
    Member
    Posted 1 year ago #

    hello

    heres my link http://www.connectto.com.br/websites/connectto/

    im using wordpress with 2 colunms (content + right sidebar)

    i updated my pages, so now i have my right sidebar also there - in the whole website, not only in index

    the only problem is, in my homepage the sidebar is ok, but in internal pages the sidebar have an empty space above search (widget area) ..

    so how can i fix this to have sidebar in pages exactly in same position of my index ?

    initialy i think about find the correct css and move this area up, but, will this move the area in my homepage also, ? i need to move only in the internal pages ...

    anyopne can help about this please ?

    thanx

  2. WPThemes.co.nz
    Member
    Posted 1 year ago #

    quick question, did you modify the page.php file? The sidebar does't seem to be in the right place compared with index.php.

  3. connectto
    Member
    Posted 1 year ago #

    yes i follow this steps to add sidebar to page http://www.transformationpowertools.com/wordpress/twenty-eleven-sidebar-on-single-posts-and-pages

    found it here in this forum - worked great - but dont know how to remove the space above widgets

    already tried to move the code to other positions in page.php but didnt worked

    if anyone know a solution, please help ! thanx :D

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    you must have missed a step in my tutorial, as there is still the .singular class in your posted page;

    as you have opted to use a copy of the theme instead of a child theme, the changes can be made directly in functions.php;

    adapt this section in functions.php (at the very end):

    function twentyeleven_body_classes( $classes ) {
    
    	if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
    		$classes[] = 'single-author';
    
    	if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    		$classes[] = 'singular';
    
    	return $classes;
    }
    add_filter( 'body_class', 'twentyeleven_body_classes' );

    change the one line to:

    if ( ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )

    (untested)

  5. connectto
    Member
    Posted 1 year ago #

    uou thanx alchymyth you alllways rock !

    i just need a help - i dont think if i really understood correctly

    do i need to substitute this whole piece of code:

    function twentyeleven_body_classes( $classes ) {

    if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
    $classes[] = 'single-author';

    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    $classes[] = 'singular';

    return $classes;
    }
    add_filter( 'body_class', 'twentyeleven_body_classes' );

    substitute with this one line code :

    if ( ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )

    or i need to substitute just part of the code ?

    i try top substitute the whole piece of code, but didnt work,

    didnt understood exactly what means "change the one line to:" - the original piece of code that you show above have more than one line.. which one should i substitute ?

  6. connectto
    Member
    Posted 1 year ago #

    ok i think i understood which line should i replace...

    so i did replace the line

    ----------------------------------

    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )

    --------------------------------

    with this line

    --------------------------------

    if ( ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )

    ---------------------------------

    but actually didnt work

    also tried to just add the extra line of code so i get this

    ------------------------------------

    function twentyeleven_body_classes( $classes ) {
    
    	if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
    		$classes[] = 'single-author';
    
    	if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    		$classes[] = 'singular';
    
    	if ( ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    
    	return $classes;
    }
    add_filter( 'body_class', 'twentyeleven_body_classes' );

    ------------------------------------

    but also didnt work...

    [Please post code or markup snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    my mistake - on closer inspection, just removing the mentioned line should work;

    i.e. that section should just look like:

    function twentyeleven_body_classes( $classes ) {
    
    	if ( function_exists( 'is_multi_author' ) && ! is_multi_author() )
    		$classes[] = 'single-author';
    
    	return $classes;
    }
    add_filter( 'body_class', 'twentyeleven_body_classes' );
  8. connectto
    Member
    Posted 1 year ago #

    well now my widget area is under my main content http://www.connectto.com.br/websites/connectto/

    yesterday i did some modifications in style.css in order to make the width of page content similar to home width

    its like this now

    --------------------------------

    .left-sidebar.singular #content {
    margin: 0 -15%;
    position: relative;
    width: 120%;
    }

    ---------------------------------

    it worked fine yesterday, now i try to change this values to see if this is the problem and it seems to be irrelevant - it seems that the new function.php settings make this item on css irrelevant

    anyway - i can see that my left margin of page conteant is ok - so the only problem it seems to be the position of widget - it seems that i can even put the old values again in this piece of css, now the problem with page.php left margin its ok, i think thats because of the function.php modifications

    donty know if my modifications in style.css .left-sidebar.singular #content are the reason that made function.php settings dont work well

    im just explaining here to try to help find where is the problem hehe

    anyway, anyone can help ? it seems to be really near to fix this..

    sorry bad english, sometimes is dificult to explain what i want to say.. thanx

  9. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    your sidebar seems to inserted too early:
    - the line:
    <?php get_sidebar(); ?>
    needs to be just before the line:
    <?php get_footer(); ?>

    (both in page.php and single.php)

  10. connectto
    Member
    Posted 1 year ago #

    thanx alchymyth

    without this forum i dont know what could i do , really thanx

Topic Closed

This topic has been closed to new replies.

About this Topic