Archived topic
List individual Q&As
39 replies · Started by John on July 12, 2021
It's this one, Leo:
add_filter( 'generate_show_excerpt', function( $show ) {
if ( is_category( array( 'communication', 'agreements'. 'persuasion' ) ) ) {
return true;
}
return $show;
} );
I just tested it. However, it created excerpts of the posts, approximately 750 of them, under Patterns (parent) on my site. With the snippet I am targeting roughly 150 posts under Discussions (parent). I forgot to mention that.
I suspect that you need to add to the code above a pointer to that parent (Discussions).
john
I'm not 100% sure if I understand the requirement.
All the available WordPress conditional tags are listed here though so can you go through them and see which one you need?
https://codex.wordpress.org/Conditional_Tags
Thanks for the rapid reply, Leo !
I did a poor job of explaining the context. Let me try to get it right this time.
I have on my site - understand-culture.com - lots of pages and posts. Under "Germany", "United States", and "Germany-USA" you see nothing but pages. Under "Patterns", "Discussions", and "Exercises" you will see nothing but posts.
You can use these credentials to login ... email: john.doe@understand-culture.com ... password: johndoe
Or you can simply choose the topic Persuasion on any page. It is open-access.
The posts in Discussions are Q&As: title of post + question + my response + commenting. If you choose "Discussions" in the menu you will be taken to a page. On the page is a directory of topics. There are ten topics plus both countries.
I would like the snippet to gather and display only those posts (aka Q&As) linked to the topic the user has chosen: i.e.
Agreements or Communication or Decision Making.
I have created a category for each of the ten topics. These categories have one single parent: Discussions. However, I am not sure what the slug for each child should read. I have used: agreements-discussions.
Why "-discussions"? Because I am using the names of the topics - i.e. Agreements, Communication, Persuasion, etc. ... a children of other parent categories, such as Topics and Exercises.
I understand why you referred me to the WordPress list of conditional tags, so that I learn how to do this myself. However, I don't have command of even the most rudimentary php-coding skills. Therefore my request that you create the code for me. You're welcome to give me variations of the snippet code if you are not sure how it should read.
Thank you !
John
. . . a clarification, Leo:
I would like the snippet to gather and display only those posts (aka Q&As) linked to the topic the user has chosen: i.e.
Agreements or Communication or Decision Making. But since my replies are so long, I would like the snippet to diplay only an excerpt of the posts in the stream.
This makes it easier for users to stream through and choose which posts they wish to open up in full text.
Try this snippet instead:
add_filter( 'generate_show_excerpt', function( $show ) {
if ( !is_category( array( 'communication', 'agreements', 'persuasion' ) ) ) {
return false;
}
return $show;
} );
Hi David,
I could save the snippet, but it did not create excerpts for the posts of those three categories. Does the snippet have to define "excerpt" with the amount of characters or words?
John
What do you have the Content Type set to in Customizer > Layout > Blog ?
I have it set to: Full Content.
Heck, I forgot about that in the Customizer. However, I just changed it to excerpt and 25 words, but saw no difference in the posts. I suspect I need in addition to that change either some CSS and/or PHP.
John
Hi John,
Any chance you can share temporary admin login access in the private information field? That will allow us to take a look at how these posts are structured. They should be displaying as excerpts if you've set it that way in the Customizer.
Let me know :)
Yes, Tom, I would be happy to give you Admin status.
Please see Private Information.
Thanks.
John
Hi John,
Can we test a few things?
What happens if you replace the PHP snippet with this?
add_filter( 'generate_show_excerpt', function( $show ) {
$show = false;
return $show;
}, 20 ,1 );
All excerpts on the entire site shouldn't render once this is active. If the excerpt still renders even when this is activated, then there must be something that prevents the filter from applying. (perhaps the page is being cached)
To check for this, can you try disabling all plugins except GP Premium and check if the filter finally works?
Also, can you clear all possible caching? ( from plugin, from server page cache, from CDN)
Hello Elvin,
Thanks for the proposed solution. Unfortunately, it did not have the hoped for effect. I cleared the cache in my browser, Safari. I do not know how to clear the server page cache. I also deactivated all of the plugins except GP Premium.
Did you see that I had given your colleague, Tom, access to the backend as an admin? Maybe use can use that, too, in order to go into the backend and try various solutions. Please see the admin login credentials in Private Information.
Thanks.
John
Hi John,
Yes, all support team members can see the private information provided. :D
That's definitely strange. If even the simplest filter that should remove ALL excerpt isn't working, something must be preventing it from applying.
Any chance you can clone the site to a staging site so we can conduct further tests? This is so the live site doesn't get affected when we do changes.
Let us know.
Hi Elvin,
I just spoke with United Domains, my hosting company here in Germany. Cloning is possible. However, it would have to be done manually: creating data-bases, copying over files, paying attention to any customization. I am not inclined to take this route. It would be time-consuming and I would most likely get it wrong.
A possible cause of the problem just popped into my mind. I have an excellent coder in the UK, David, who has done some customization for me. For example, he created a commenting system for me. See any posts in Patterns, Discussions, or Exercises.
Please let me reach out to David and ask him if his customization has had any impact on the situation.
Thanks.
John
Elvin,
Here is the text of the email I just sent to David in the UK:
"David,
I created UC with GeneratePress.
GP is great. I did all of the work myself.
With a lot of help from their support folks.
Canadians. First-rate !
We’re having a problem, however.
If you look at some of the Q&A on
Discussions you’ll see my rather
lengthy responses.
We want to set things up so that users
can scroll through the many Q&As and
choose which they wish to open and read
at full length.
There is a simple, straightforward setting
in WordPress for this. For some reason,
however, it is not working.
I am wondering, could it be that your commenting
customization has in some way deactivated or
otherwise altered that WP-setting?
I know that you don’t spend much time fooling
around with WordPress sites, but could you take
a look at that possibility?
And one final note: I am trying to set up excerpting
only on posts under Discussions and Exercises.
And NOT under Patterns. Most of those posts are
moderate in length.
See below links.
Thanks !
John"