I have a post with a tablepress table with many columns. When the post is added to RSS, Mailchimp emails it out, but the table is jumbled due to the many columns squeezed together.
I found the table appears correctly if I trim all columns but the first 2, so I'm seeking a way to get a trimmed table into the RSS feed while the full table remains visible/accessible in the post.
I've tried multiple approaches to do this and am open to other options. My latest attempt was creating a duplicate post with the trimmed table and using code to hide the duplicate post in the blog - see below. But this and other snippets using pre_get_posts keeps failing to hide the post.
function myFilter($query) {
if ($query->is_feed) {
$query->set('cat','-1'); //Don't forget to change the category ID
}
return $query;
}
add_filter('pre_get_posts','myFilter');
is_feed
is true or false to show larger or smaller tables. Also note that$query->is_feed
is not a variable, it's a function and needs()
on the end