Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
524 views
in Q2A Core by
closed by
I have an idea to use Q2A feature to create custom pages to write articles because it's simple, SEO-friendly and really customizable. I don't use blog plugin because these articles are not blogs and they have different structured data markups. Just imagine they are recipe, book or review pages.

There will be about hundreds or even thousands of these articles if I manage to write, so I need some ways to list them like the way we list questions.

The listing style is simple without voting feature, but how do I list them with pagination. Of course, I won't ask for a full code here, but any general idea to do so?
closed with the note: finally made it
by
Maybe you can create a simple HTML page where you can list them one by one
by
Thanks. That'll be the last resort if things won't go according to plans.

1 Answer

+1 vote
by
edited by

Custom pages are stored in the table qa_pages, so you should be able to fetch them like this:

SELECT pageid, title, tags, heading FROM qa_pages;

and then construct the list from that information.

For pagination you'd modify the query to limit the returned results:

SELECT pageid, title, tags, heading FROM qa_pages LIMIT start, end;

where you calculate start as (list_page_index - 1) * items_per_page and end as start + items_per_page.

Example: if you display 20 pages per list page you'd calculate start and end for the third list page like this:

start = (3 - 1) * 20 = 40
end   = 40 + 20      = 60

The query will then give you the custom pages from rows 41 through 60.

The total number of rows in the table can be determined like this:

SELECT COUNT(*) FROM qa_pages;

so that you can calculate the number of list pages as row_count / items_per_page.

by
Thanks. I'm looking at a different plugin that also outputs lists with pagination using some Q2A built-in features like qa_html_page_links... but it's quite complicated, and I need some time to test.
...