picandocodigo/List-Category-Posts

customfield_orderby not displaying posts using shortcode?

Closed this issue · 2 comments

Steps to reproduce

  • I downloaded this this plugin: https://en-gb.wordpress.org/plugins/smart-custom-fields/
  • I created a custom field called 'series_post_order'. I created a custom 'Select' field with possible values 1,2,3,4,5,6,7,8,9,10.
  • I set this value for each post in my category called "My Series"
  • In my post, I then pasted:
    [catlist name="My Series" conditional_title="Other Posts in this Series:" numberposts=5 pagination=yes customfield_name="series_post_order" customfield_orderby="series_post_order" order="asc"]

Expected behavior

It displays posts in the category called "My Series" ordered by a custom field called "series_post_order"

Actual behavior

It doesn't display anything. Incidentally, this works fine (without custom sorting):
[catlist name="My Series" conditional_title="Other Posts in this Series:" numberposts=5 pagination=yes]

WP version, LCP plugin version (versions of other software if relevant, e.g. PHP)

Latest

  1. You do not need to use customfield_name for customfield_orderby to work. You can sefely remove it from your shortcode.
  2. I gave it a try and it worked without issues on my end.
  3. Your mistake was that you used customfield_orderby="series_post_order" while the actual custom field added to the posts was "Select" i.e. customfield_orderby="Select"

Sorry, this does work. I think it didn't earlier because I was viewing the post in preview mode before actually saving the custom field value (I should have clicked 'update' as opposed to just 'preview'). The working shortcode is:

[catlist name="My Series" conditional_title="Other Posts in this Series:" numberposts=5 pagination=yes customfield_orderby="series_post_order" order="asc"]

Thanks for your prompt reply.