- This topic has 39 replies, 5 voices, and was last updated 2 years, 9 months ago by David.
-
AuthorPosts
-
July 12, 2021 at 2:18 am #1852493John
Hello GP-Support !
I’m into my third week with GP and think it is great. Thank you for such a great product and for such equally great service. Here comes another question:
I will add a discussions section to my site. Discussions in the sense of Q&A and commenting. The individual Q&As are posts, not pages. Is there a way to create a page which contains a directory (I know how to create directories) which, in turn, lists the topics: i.e. Communication, Decision Making, Processes? Choosing a topic then takes the user to a list of the titles of individual Q&As?
“Discussions” – a page – would be a term in the off-canvas menu.
On that page – named Discussions – would be a list of topics: Communication, Decision Making, Processes, etc.
Choosing a topic, for example, Communication then leads to a list of Q&A-titles.
Choosing a title takes the user to that individual post, which contains: Question … Answer … Commenting.Thanks !
John Magee
July 12, 2021 at 4:20 am #1852628DavidStaffCustomer SupportHi there,
are the Topics a Taxonomy ( eg. Category ) for the posts ?
July 12, 2021 at 4:50 am #1852652JohnHello David,
yes, the topics are a taxonomy. Currently there are 10 topics: Communication, Agreements, Persuasion etc.
The Parent Category is “Discussions”.
John
July 12, 2021 at 5:01 am #1852656DavidStaffCustomer SupportAs you have the plugin for creating the directories – you just need to create a Static page to add the directory for listing your Topics. Each link will then take you to that topics archive.
July 12, 2021 at 5:17 am #1852662Johnyes, David. However, when choosing a topic from the directory, i.e. Communication, all of the posts categorized with “communication” will be pulled and presented. Those individual Q&As, however, are long: question + my response + comments from users.
That makes it cumbersome for users to choose which Q&A interests them. Once they’ve chosen a topic from the directory I’d like only the title of all of the Q&As linked to that topic to appear. Otherwise they have to scroll through full-body texts of currently 100+ Q&As. Whereas the ideal flow would be:
Go to Discussions directory.
Choose a topic, i.e. Communication.
See a list of Q&A-titles.
Choose a Q&A.
The post is presented: Question + John-Response + Comments.john
July 12, 2021 at 5:43 am #1852698DavidStaffCustomer SupportWe just need to change the behaviour of the Archive Template being used for the various Topics.
Theres a couple of ways to do this. First a question; are you using the Block Editor ?July 12, 2021 at 5:48 am #1852711Johnnot sure what you mean with “Block Editor”. I have newest version of WP and GP. In the backend in a post or page I have on the righthand side Page Block and Post Block.
July 12, 2021 at 5:49 am #1852713Johnwould it help if I gave you admin-status on the site?
July 12, 2021 at 5:54 am #1852720Johnperhaps there is another solution, David, namely that we have the individual Q&A (posts) displayed not as full-body text, but instead as an excerpt. is that possible?
users would read: title of post + question.
John
July 12, 2021 at 8:07 am #1853035DavidStaffCustomer SupportIf you have the Full Content displayed on your blog / archives then you can use this PHP Snippet to set the excerpt for a specific category:
add_filter( 'generate_show_excerpt', function( $show ) { if ( is_category( array( 'cat-term-1', 'cat-term-2', 'cat-term-3' ) ) ) { return true; } return $show; } );
I included the array so you can specify multiple Category terms.
And then you can use the
option_generate_blog_settings
filter to disabling other elements such as meta:https://docs.generatepress.com/article/option_generate_blog_settings/
July 12, 2021 at 9:21 am #1853108JohnI created the snippet below, but it did not work. Please check the syntax.
add_filter( ‘generate_show_excerpt’, function( $show ) {
if ( is_category( array( communication, agreements, persuasion, decision-making, leadership, feedback, conflict, product, process, customer ) ) ) {
return true;
}return $show;
} );July 12, 2021 at 12:26 pm #1853318LeoStaffCustomer SupportLooks like you are missing some quotation marks around each category.
Please compare David’s code with your code or take a look at the example here:
https://codex.wordpress.org/Conditional_Tags#A_Category_PageJuly 12, 2021 at 1:07 pm #1853337JohnHi Leo,
I suspect it’s more than just the quotation marks. Can you, please, ask David to give me exact instructions on how to get the code right?
Thank you.
John
July 12, 2021 at 1:17 pm #1853361LeoStaffCustomer SupportEdited David’s code above slightly to remove the syntax error.
Tested in Code Snippets to make sure it doesn’t have any errors:
https://www.screencast.com/t/XKdc9YzEUzYou just need to replace
cat-term-1
cat-term-2
etc without removing the quotations and modifying anything else.July 12, 2021 at 1:51 pm #1853385JohnHi Leo,
ok, this is the correct code:
add_filter( ‘generate_show_excerpt’, function( $show ) {
if ( is_category( array( ‘cat-term-1’, ‘cat-term-2’. ‘cat-term-3’ ) ) ) {
return true;
}return $show;
} );However, it is still not clear to me what I put in. Is this the correct second line:
if ( is_category( array( ‘cat-term-communication’, ‘cat-term-agreements’. ‘cat-term-persuasion’ ) ) ) {
communication, agreements, and persuasion are the first three of my ten topics, in other words the first three categories.
Or is this the correct second line:
if ( is_category( array( ‘communication’, ‘agreements’. ‘persuasion’ ) ) ) {
-
AuthorPosts
- You must be logged in to reply to this topic.