Forum Replies Created

Viewing 13 replies - 16 through 28 (of 28 total)
  • Thread Starter werlisa

    (@werlisa)

    Thread Starter werlisa

    (@werlisa)

    Thread Starter werlisa

    (@werlisa)

    For the categories runs smoothly but when replaced by is_search () the site stops working and the screen is blank .. I did something wrong?

    function limit_posts_per_archive_page() {
    	if ( is_search() )
    		set_query_var('posts_per_archive_page', 10); // or use variable key: posts_per_page
    }
    add_filter('pre_get_posts', 'limit_posts_per_archive_page');
    Forum: Fixing WordPress
    In reply to: New Query Post
    Thread Starter werlisa

    (@werlisa)

    Works! It seems incredible what you can do a little change .. ??

    Thank you very much for your help, especially for you Zoe.

    I have visited your blog Zoe, and there is a very interesting aspect that I put into practice successfully. This is limiting the number of posts by category by adding this feature:

    function limit_posts_per_page() {
    	if ( is_category() )
    		return 2;
    	else
    		return 5; // default: 5 posts per page
    }
    add_filter('pre_option_posts_per_page', 'limit_posts_per_page');

    I wonder if you can do the same with the results of the search … is it possible?

    By the way, I opened another question about it here:

    https://www.ads-software.com/support/topic/393462?replies=1

    Regards!

    Forum: Fixing WordPress
    In reply to: New Query Post
    Thread Starter werlisa

    (@werlisa)

    There is no way that goes well,

    I tried your suggestion and everything remains the same, sticky posts continue to be anchored at the top of the index…this is a headache!

    Thanks for your help Zeo

    Forum: Fixing WordPress
    In reply to: New Query Post
    Thread Starter werlisa

    (@werlisa)

    Hi Zeo, MichaelH proposed solution according to all the references I have consulted “including wordpress codex” is the correct solution. The problem is that this solution does not work on my site, I think the query post on my site makes it more difficult to make sticky posts are not anchored at the top and in my opinion this part of the code is to blame that:

    $i = 1;
    if(!empty($_GET['sort']))
    {
    $orderby=trim($_GET['sort']);
    $order=trim($_GET['order']);
    $key=trim($_GET['key']);

    Have an idea?

    Regards

    Forum: Fixing WordPress
    In reply to: New Query Post
    Thread Starter werlisa

    (@werlisa)

    Can anyone help me?

    Forum: Fixing WordPress
    In reply to: New Query Post
    Thread Starter werlisa

    (@werlisa)

    Thanks for the reply.
    I tried the query post plugin and it works wonderfully but it is a widget and not affect the overall outcome of the site, continuing the sticky posts anchored to the top of the site.

    As for the wordpress codex I’ve consulted to find the solution “caller_get_posts=1” but this seems not to work on my site.

    <?php
    $i = 1;
    if(!empty($_GET['sort']))
    {
    $orderby=trim($_GET['sort']);
    $order=trim($_GET['order']);
    $key=trim($_GET['key']);
    // create the sort by injection
    $posts = query_posts($query_string . '&orderby='.$orderby.'&meta_key='.$key.'&order='.$order.'&caller_get_posts=1');
    }
    if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php if ($i % 2 == 0) { $alt = " class=\"alt\""; } else { $alt = " class=\"no\""; } echo "<div" . $alt;
    if (is_sticky()) { echo " id='sticky' "; } echo ">";
    ?>

    I do not know what else I can do … my head will explode! ??

    Thread Starter werlisa

    (@werlisa)

    Can anyone help me? plsss!!

    Thread Starter werlisa

    (@werlisa)

    Thanks again for your answer, perhaps as you say should apply a new WP_Query but the truth is that my knowledge is rather limited and do not know how to do this.

    There is no way to modify the existing WP_Query?

    Thread Starter werlisa

    (@werlisa)

    $posts = query_posts($query_string . '&orderby='.$orderby.' meta_key='.$key.'&order='.$order.'&caller_get_posts=1');

    Thank You, I changed as you say but everything remains the same and continue to sticky posts at the top … I do not understand why.

    Thread Starter werlisa

    (@werlisa)

    I’ll be back to share the code because they do not see anything good in my first post ..

    <?php
    $i = 1;
    if(!empty($_GET['sort']))
    {
    $orderby=trim($_GET['sort']);
    $order=trim($_GET['order']);
    $key=trim($_GET['key']);
    // create the sort by injection
    $posts = query_posts($query_string . '&orderby='.$orderby.'&meta_key='.$key.'&order='.$order.'');
    }
    if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php if ($i % 2 == 0) { $alt = " class=\"alt\""; } else { $alt = " class=\"no\""; } echo "<div" . $alt;
    if (is_sticky()) { echo " id='sticky' "; } echo ">";
    ?>
    Thread Starter werlisa

    (@werlisa)

    Thank You, I changed as you say but everything remains the same and continue to sticky posts at the top … I do not understand why.

Viewing 13 replies - 16 through 28 (of 28 total)