Passing Variable Via Excerpt Function
-
I’m trying to display three different excerpt layouts on my home page.
The way I imagine it working is to pass a variable via the excerpt function and using an if statement to decipher which layout to use.
I found this post https://www.catswhocode.com/blog/how-to-overwrite-wordpress-core-functions which I assume is what I need to do.
However by that point I’m pretty much in over my head so I am hoping someone here can first off tell me if this is even possible, and if so provide me with the code I need.
I have a plugin which includes a template for the excerpt therefore the variable needs to be passed into the template. So I’m not sure if the_exceprt($variable) is going to cut it or not. Or perhaps I can just declare the variable as global?
Anyhow I hope that makes sense, any help would be much appreciated. There is likely a much easier way to achieve this.
Cheers,
Mike.
- The topic ‘Passing Variable Via Excerpt Function’ is closed to new replies.