• Resolved andynick

    (@andynick)


    Is it possible to change the order in which posts are listed in a given category – such as by using a number in a custom field?
    Thanks, Andy

    The page I need help with: [log in to see the link]

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter andynick

    (@andynick)

    No. I’m sorry but that didn’t work @mrfoxtalbot
    The posts were displayed in the wrong order (they appeared most recent first) and changing DESC to ASC made no difference. Also, only eight posts showed on each page.
    I even tried it on Staging, with all plugins except Code Snippets deactivated.
    I have that awful sinking feeling now! I guess I’m stuck with the plugin I don’t like.
    Thank you for your help, anyway.

    I apologize for not being very clear in my previous reply @andynick. What I meant was that the sample code you shared was using incorrect syntax and was just not going to work no matter what.

    First of all, if you are adding the code via Code Snippets, you can ignore the add_action( 'wp_head', function () ) part. Code Snippets will just execute it for you.

    Second, for reference, the <script> tags are only used with JavaScript code (you are using PHP here) you will want to keep all the PHP code within the correct tags

    <?php 
    // your php code goes here
    ?>
    

    If you are writing PHP code in the future and are unsure wether the syntax is correct, you can use a free online syntax checker such as this one here https://phpcodechecker.com/

    I am not quite sure what could be preventing the code from working on your end. I have recorded this short video illustrating the multiple steps in the hope that it will help us spot what could be different.

    I am hoping that will help!

    Thread Starter andynick

    (@andynick)

    Working now, @mrfoxtalbot !!!
    Thank you SO much – you’re a star!
    I think the script tags were the culprit!

    I’m so relieved – that was holding back progress, and thanks to your patience (and expertise) it works well now!
    Best wishes, Andy

    Ah, I’m so glad that worked out in the end!
    Good luck with your site and with the sheep, @andynick!

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Category List Order’ is closed to new replies.