Posted: August 8, 2016 at 3:30 pm
|
Hello, Continuing from this thread: I’d like to add the tags (which I use for language of the courses) and also the event category into the csv download. For the tags, based on your guidance, I wrote this code, would that work?
I would also like to add the event category, should I use this example? |
What you have so far will not work because you’ll need to pass in the post ID (or in this case event ID) to the get_the_tags() function. e.g. Also, the way you have the counter set up, it will show only one tag for the event. If you want all tags, you’ll remove the counter from the loop.
You’ll actually need to use get_the_terms() because event categories are a taxonomy term, which is very similar to a post category, but they’re not one and the same. |
|
|
Hi, For the tags, I updated the code to the following but something is wrong, the report gets stuck at zero percent. Any ideas what’s wrong?
For the category, how should I change the code then? I’m not really clear how to apply this example into the code to add just the category. |
You need to clean up your code Oguzhan. First, you should not be echo’ing anything there. So this:
needs to be something like this instead:
I mentioned this before, but it bears repeating: If you want to display all of the tags, you’ll need to remove the counter.
You could also use https://developer.wordpress.org/reference/functions/get_the_term_list/ |
|
|
Hi there, Thank you for your input. It worked with the new code – I have the tags displayed (left the counter on because I anyway only have one tag to represent the language the course is given). The only strange result was that in the download, the tag data showed up under the “Transaction Promotions” heading (column AI), and it “pushed” the data of the Transaction Promotions to column AJ. I.e. it did not create a heading for itself. For the category, I read the documentation of the get_the_term_list, but I have no idea how to apply to EE4. If it will be very difficult, i can survive without it. |
You might try removing the counter first to see if that makes a difference. |
|
The support post ‘Adding tags and event category to CSV download’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.