• xiscomax

    (@xiscomax)


    The sticky theme in my posts are used for outstanding tickets but I would like to stop being sticky and be integrated in order of publication with the other entries.

    Example:

    Post id.5 normal
    Post id.4 sticky
    Post id.3 normal
    Post id.2 sticky
    Post id.1 normal

    It would be possible?

Viewing 11 replies - 1 through 11 (of 11 total)
  • MichaelH

    (@michaelh)

    This should work:

    <?php query_posts($query_string . '&caller_get_posts=1'); ?>

    Related:
    query_posts()

    Thread Starter xiscomax

    (@xiscomax)

    I do not work, maybe not done well.

    this is my code in my template index.php.

    any other help?

    <div class="list">
    					<?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 ">";
    					?>
    MichaelH

    (@michaelh)

    What about adding the &caller_get_posts=1 to the query???

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

    Thread Starter xiscomax

    (@xiscomax)

    Thanks but not work.

    The sticky posts are still in first place.

    ?

    MichaelH

    (@michaelh)

    Please post a link to download your theme, and then please paste all the code from the theme template file that is displaying those posts into a pastebin, such as wordpress.pastebin.ca, and report the link back here. Maybe someone can spot your problem. Thanks.

    Thread Starter xiscomax

    (@xiscomax)

    My theme is to pay, but we can see the full index.php.

    https://wordpress.pastebin.ca/1673555

    thank you very much

    MichaelH

    (@michaelh)

    Well that pastebin show a bunch of wrong variables. I am guessing something like “$ post” should be “$post” — maybe need to say it is PHP next time.

    Anyway try changing this line:

    $ Posts = query_posts ($ QUERY_STRING. '& Orderby ='. $ Orderby. Meta_key & = '. $ Key. Orden "& order ='. $ .'');

    to

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

    Otherwise I don’t see what the problem would be. If this doesn’t fix the problem, maybe you can ask the theme author you bought that theme from.

    Thread Starter xiscomax

    (@xiscomax)

    Sorry, https://wordpress.pastebin.ca was translated with Google when you post the pastebin and modify the code. Php

    Here you can see the code again. https://wordpress.pastebin.ca/1674073

    Excuse you, but I just check that your code works but only appear integrated sticky posts from the 2nd page.

    In index and categories continue to display the sticky sticky posts first.

    Again thanks for your help.

    The theme I use, is classipress. is a great pity that the support forum has little activity.

    Now I’m more happy seeing something that runs your code.

    Any idea to work on the front page and in categories?

    MichaelH

    (@michaelh)

    With the help of the Template Hierarchy article, determine what Template is displaying your front page and categories and make similar changes.

    Thread Starter xiscomax

    (@xiscomax)

    I just realized the sticky posts that are not maintained in the highest within the categories.

    Results tested with the default wordpress theme.

    It is then a failure of wordpress?

    Whether or not a failure is what I want but in the main page too.

    In that case, I have to change any file, not the wordpress theme?

    Greetings and thanks

    Thread Starter xiscomax

    (@xiscomax)

    Hello again, I hope not to bore you with this.

    Performing tests in index.php

    Eliminated this part of code.

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

    Result index.php file as follows.

    <div class="list">
    
    		<?php $posts = query_posts($query_string .'&caller_get_posts=1&orderby='.$orderby.'&meta_key='.$key.'&order='.$order.''); ?>
    
    		<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>

    Functional seems good, but I want not remove those functions from that part of code.

    I should add any GET or modify this piece? To keep it?

    Pardon my English is not my language.

    Greetings

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘The sticky posts to integrate with the normal posts.’ is closed to new replies.