Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter dr06u

    (@dr06u)

    You are right it’s from a plugin. Thank you and sorry for the dumb question :(( I didn’t thought that could be from a plugin. Thank you again!

    Thread Starter dr06u

    (@dr06u)

    -Edit- link removed.
    But now are more than 1 pages. But I can delete them if it is needed.

    Thread Starter dr06u

    (@dr06u)

    I finally solved it like this:

    <div id="first-loop-container">
    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
    
    <?php if ($count <= 5) : ?>
    <h4 title="<?php the_title(); ?>"><?php the_title(); ?></h4>
            <?php the_content(" More...",TRUE,'');
        <?php endif; endwhile; ?>
    </div>
    
    <div id="second-loop-container">
    <?php rewind_posts();
    $cnt = 0;
    while (have_posts()) : the_post(); if ($cnt >= 5 ): ?>
    <h4 title="<?php the_title(); ?>"><?php the_title(); ?></h4>
            <?php the_content(" More...",TRUE,'');
    <?php endif; $cnt++; endwhile; ?>
    
    </div>
    
    <?php
    global $wp_query;
    
    $big = 999999999; // need an unlikely integer
    
    echo paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'prev_text' => __('&laquo; Inapoi'),
        'next_text' => __('Urmatoarea &raquo;'),
        'current' => max( 1, get_query_var('paged') ),
        'total' => $wp_query->max_num_pages
    ) );
    ?>
    <?php else : ?>
    <?php endif; ?>

    Thank again for you answer sreedhanya.

    Thread Starter dr06u

    (@dr06u)

    I managed to partially fix pagination by adding code from this post

    https://www.ads-software.com/support/topic/plugin-wp-pagenavi-wp_pagenavi-does-not-work-with-offset?replies=17

    Like this :

    <?php $my_query = new WP_Query('showposts=5'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h4>" title="<?php the_title(); ?>"><?php the_title(); ?></h4>
    <?php the_content(" More...",TRUE,''); ?>
    <?php endwhile; ?>
    
    second section of your template display old five posts
    <?php
    $last_five = get_posts('numberposts=5');
    $last_five_ids = array();
    if( $last_five ) foreach( $last_five as $last_post ) { $last_five_ids[] = $last_post->ID; }
    $my_query = new WP_Query(array('post__not_in' => $last_five_ids, 'posts_per_page' => 5, 'paged' => get_query_var('paged') ) );  ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h4>" title="<?php the_title(); ?>"><?php the_title(); ?></h4>
    <?php the_content(" More...",TRUE,''); ?>
    <?php endwhile; ?>

    Now I need a solution to make the first loop skip every 5 next posts. Because the problem is that the first loop displays on the next page the 5 posts from the second loop of the page before(the first page), while the second loop displays on the next page the 5 posts that the first loop should have displayed.

    In other words I have , for example, 20 posts, instead of having 2 pages with 5 posts in the first loop and 5 in the second I have 3 pages :
    First page: 5 posts in the first loop and 5 in the second
    Second page: 5 posts (the 5 posts from the first’s page second loop) in the first loop and 5 posts in the second loop (the posts that should be in the first loop of this page *second page)
    -…and so on…
    Thank you.

    Thread Starter dr06u

    (@dr06u)

    One more question :
    How do I make pagination now? I was having

    <?php
    global $wp_query;
    
    $big = 999999999; // need an unlikely integer
    
    echo paginate_links( array(
    	'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    	'format' => '?paged=%#%',
    	'prev_text' => __('? Previous'),
        'next_text' => __('Next ?'),
    	'current' => max( 1, get_query_var('paged') ),
    	'total' => $wp_query->max_num_pages
    ) );
    ?>

    But this doesn’t work anymore with this loop

    [ Please do not bump, that’s not permitted here. ]

    Thread Starter dr06u

    (@dr06u)

    Thank you a lot !!!!!! Works perfect!

    Thread Starter dr06u

    (@dr06u)

    *(sry for double posting but I can’t edit the post above.)

    LATER :

    Problem SOLVED like this:

    <div id="container" style="width:1024px;">
            <div id="content" style="background:#0F0; height:500px; width:100%;">
    
                <div id="sidebar" style=" background:#C30; width: 200px; height:500px;float:right;">
                    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                    quis nostrud exercitation
                </div>
    
             Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
             tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
             quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
             consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
             cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
             proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
            </div>
    
        </div>
    Thread Starter dr06u

    (@dr06u)

    How would absolute positioning help me?
    If I have a #container of 1024px width and nested inside it two divs, one (#content) with relative positioning and no fixed width and one (#sidebar) with absolute positioning and a fixed width. The #content div will expand the whole width of the #container (1024px) and the #sidebar will float next to it. The thing I want to achieve is to float the #sidebar next to the #content inside the width of the #container (1024px) without setting any width at all on the #content div. I don’t want the sidebar to be outside the #container div , I want the #sidebar to force the width of the #content to collapse and fill the remaining space (1024px – 200px[width of the sidebar])

    Thread Starter dr06u

    (@dr06u)

    Hmm…
    What will activate / deactivate the sidebar?
    Is it going to be interactive, like using jQuery to hide / show the sidebar?
    If so, you can add a function that occurs when the sidebar is hidden / shown that alters the class on your div#content. The class can then specify the width (in your CSS.)
    Paul

    If I take out all the widgets from the sidebar (if it’s empty) wordpress automatically makes the markup of the sidebar to dissapear (there is no div from sidebar) only the content div remains in the site source code.
    So what I want is that when I delete all the widgets from the sidebar (and the div is gone) the #content div to expand all the width of the #container (1024px). It already does this but when the sidebar has widgets on it, the container div still stays expanded to 1024px and does not let the sidebar to float besite it.

    A good way to do this is:

    on the div ‘container’ use:

    display: block;
    width: 100%;
    then for nested div(s) use

    display: inline;
    float: left;
    width: xx%;
    (xx will be 50% if 2 nested div’s, 33% if three, etc. or what works best – different styles can be applied to each nested div, i.e., 60% on one and 40% on another…note: left and right margin can affect this, so keep them tight and try dropping the widths a number of two if something drops below – use padding if it’s crowded)

    If I do that when I set container div to 50% width , when the sidebar is gone (when there are no widgets active and wordpress automatically deletes sidebar’s markup from site sourcecode) the content div will stay at 50% width and I don’t want that I want it to expand to the full size of the site (#container : 1024px). I don’t want a fixed width #content div!

    another way for CSS3, is to use:

    position: absolute;
    top: (xx)em;
    left: (xx)px;
    (or right: (xx)px;
    z-index (a number higher than the z-index of what this will ‘cover’);
    note: while em is good for vertical size, it is not for horizontal, but we can always use px for both.

    I would rather not use absolute position because it’s not very goot for cross browser.

    Thread Starter dr06u

    (@dr06u)

    PROBLEM PARTIALLY SOLVED LIKE THIS:

    <div id="container" style="width:1024px;">
    <div id="content" style="position:relative; background:#0F0; height:500px;float:left; width:100%;"></div>
    <div id="sidebar" style="position:relative; width:200px; background:#C30; height:500px;float:right; margin-right:-200px;">LALALALALA</div>
    </div>

    Seems like the margin-right:- the size of the fixed div solved the problem , it floats the #sidebar div beside the #content but still the content div has a 1024px size. :((

Viewing 10 replies - 1 through 10 (of 10 total)