studiopress / genesis-simple-faq

An accessible, performant WordPress plugin that adds FAQ management and rendering to your Genesis child theme.
10 stars 7 forks source link

Option to control number of FAQs output #29

Closed nickcernis closed 6 years ago

nickcernis commented 7 years ago

As requested in the plugin forum, users would like a way to control the number of FAQs displayed.

Suggest one or more of:

carasmo commented 7 years ago

I was wondering why posts_per_page wasn't added, I have many FAQs I want to add but it stopped at the posts_per_page option in reading settings. This was a bummer. For the time being, I just changed the plugin code and will make a note not to upgrade yet.

screen shot 2017-08-31 at 12 14 28 pm

cjkoepke commented 7 years ago

@carasmo @nickcernis So am I correct in assuming the only use-case for a FAQ count limit would be in the event of using a shortcode variation like [gs_faq cat="35"] or [gs_faq]?

nickcernis commented 7 years ago

@cjkoepke That's one good use-case, yes. Users may want to specify a limit for the widget, or override the limit with a filter in their theme.

cjkoepke commented 7 years ago

So what's the point of limiting though, unless there's pagination?

cjkoepke commented 7 years ago

You can also achieve a limit if you comma-delimit a list of IDs — but I can see adding a simple param like limit="10" being an easier approach.

nickcernis commented 7 years ago

So what's the point of limiting though, unless there's pagination?

https://wordpress.org/support/topic/number-of-items-displayed/

Users would like to easily allow more than the default number of FAQs to be displayed without editing the global Reading Settings, which affects all post types.

carasmo commented 7 years ago

So, when the option is added limit= I could add -1 to get all of them. The display posts shortcode has posts_per_page no pagination. Tough tookies -- he won't add it (make your own loop is what he says and I agree). I use it with an FAQ cpt want to show all from a specific term or all of them and no pagination.

cjkoepke commented 7 years ago

@nickcernis Ah, okay that forum topic explains it a bit better. So how about this for scope:

nickcernis commented 7 years ago

Sounds good, @cjkoepke!

cjkoepke commented 7 years ago

@nickcernis This can be reviewed, but I've added limits to both the shortcode and widget. Defaults accurately to global setting.

nickcernis commented 7 years ago

Looks good! I confirmed that:

JiveDig commented 6 years ago

Hey yall, I just posted on the WP forum but realized it's easier here. Just adding my 2-cents that I don't think this (https://github.com/copyblogger/genesis-simple-faq/issues/29#issuecomment-327260061) is the best flow. I would expected the default [gs_faq] shortcode to show all FAQs. If a limit param is used, then it uses that number. I think it would rarely ever make sense to follow posts_per_page global option. Most of the time people will want to show all, or all in a cat, or specific faqs by ID. IMHO.

nickcernis commented 6 years ago

I agree, @JiveDig – it makes sense to have no limit as the default. Pull request sent.

Tested with 100 entries generated via WP-CLI:

faq_test
dreamwhisper commented 6 years ago

I took confirmed off of this since the pull request will need to get merged to develop, then confirmed and merged to master. This way the current pull request from develop to master doesn't assume this is resolved and get released as such.

cc @nathanrice

dreamwhisper commented 6 years ago

Noting the PR functionality was confirmed.