• Resolved akhasis

    (@akhasis)


    Hello:

    I would like to sort the filter results alphabetically except for four specific items that should always show first. Is there any setup or custom filter that I can set up to achieve that result?

    Congratulations for your plugin, please keep it that useful and light and keep up the good work. Best regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello!
    We would like to clarify with you: do you mean custom sorting of terms or cards (posts)? Please send a screenshot of your filter, indicating what control you want to sort. Thanks.

    Thread Starter akhasis

    (@akhasis)

    Hello!

    Sorry for the lack of information. I need to prioritize 4 cards (posts) so that they show first and then the rest of the posts in alphabetical order when no filter is applied. Being able to display all of them sorted by a custom order instead of alphabetically would also be a solution.

    When a filter is applied, the filtered posts should also be displayed according to the rules above.

    Sorry but I’m not able to send a screenshot frombthat site, if you still need one after the explanation above, I’ll set up a fake site and send you the screenshot.

    Thanks for your attention. Best regards.

    Plugin Author YMC

    (@wssoffice21)

    We will review your request and respond to you as soon as possible.

    Thank you for using our filter!

    Hello!

    At the moment there is such a solution. Insert featured posts before the first post in the grid using the hook (https://github.com/YMC-22/smart-filter#list-filters):

    /**
     * Add custom content after every second post
     * @param {int} increment_post - post counter
     * @param {array} arrOptions - array of additional post parameters. It includes:
         - arrOptions['paged'] - page number
         - arrOptions['per_page'] - number of posts per page
         - arrOptions['total'] - number of all posts
     * @returns {string} HTML markup card post
     */
     function ymc_after_custom_layout( $increment, $arrOptions ) {
        if( $increment === 2 || $increment === ( 2 + $arrOptions['per_page'] ) ) {
          echo '<article class="post-item">
                  <h3>My Header</h3>
    	      <div>Custom text</div>
                </article>';
        }
    }
    add_action( 'ymc_after_custom_layout_545_1', 'ymc_after_custom_layout', 10, 2 );

    And then exclude those featured posts from the plugin admin panel.

    This requires knowledge of coding (PHP and JS)

    • This reply was modified 1 year, 9 months ago by ymih22.
    Plugin Author YMC

    (@wssoffice21)

    Thanks

    Thread Starter akhasis

    (@akhasis)

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom sort order’ is closed to new replies.