Closed benlk closed 4 years ago
Ken has disabled GDPR and requested the removal of:
Form for a widget titled "Manage your subscription":
<p>Are you subscribed to one or more daily digests? Add or remove subscriptions by entering the email used to subscribe:</p>
<!-- Begin Mailchimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/classic-10_7.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup form{padding: 0;}
/* Add your own Mailchimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="https://midwestenergynews.us7.list-manage.com/subscribe/post?u=ae5d3a0c6088cad29d71bf0d0&id=724b1f01f5" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<div class="">
<label for="mce-EMAIL">Email Address </label>
<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_ae5d3a0c6088cad29d71bf0d0_724b1f01f5" tabindex="-1" value=""></div>
<div class="clear"><input type="submit" value="Manage" name="subscribe" id="mc-embedded-subscribe" class="btn btn-primary"></div>
</div>
</form>
</div>
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script><script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='LNAME';ftypes[2]='text';fnames[3]='ADDRESS';ftypes[3]='address';fnames[4]='PHONE';ftypes[4]='phone';fnames[5]='MMERGE5';ftypes[5]='text';}(jQuery));var $mcj = jQuery.noConflict(true);</script>
<!--End mc_embed_signup-->
Updated 2020-05-22
I see what Ken means about search.
https://usenergystage.wpengine.com/digests/court-epa-failed-to-uphold-clean-air-acts-good-neighbor-pollution-rule/ is a digest post that contains the word "Solar" in the post content, but not in the post title.
Searching for a digest by the word "solar" between two dates that this post falls within does not return that post. Additionally, the search results contain posts outside the specified dates.
It looks like the "After" parameter isn't working correctly in the query.
https://github.com/INN/umbrella-energynewsnetwork/pull/101/commits/e927f5be3745130981c1973894e689417b05beb4 fixed the "after" search, and also appears to have somehow fixed some of the issues with a search for "solar" on staging.
Trying to find https://usenergystage.wpengine.com/digests/court-epa-failed-to-uphold-clean-air-acts-good-neighbor-pollution-rule/ : a post with "solar" in the post_content but not in the title, published May 20.
However, a search not constrained by date for "solar" shows items in descending order that all have "solar" in their headlines. https://usenergystage.wpengine.com/category/digest/?digest-search=solar&after=&before=&search+submit=
The reason why appears to be suggested by https://usenergystage.wpengine.com/category/digest/?digest-search=solar&after=2020-05-17&before=&search+submit= , which shows first posts with "solar" in their title and then posts without. So maybe there's something in the orderby params that we can use here.
The orderby is by date, desc, but what's happening is that the actual query is first for post title, second for post excerpt, third for post content:
'request' => '
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1
AND (
wp_posts.post_date > \'2020-05-17 23:59:59\'
) AND (
wp_term_relationships.term_taxonomy_id IN (20198,20348,20710,20711,20720,20721)
) AND ((
(wp_posts.post_title LIKE \'{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}solar{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}\')
OR (wp_posts.post_excerpt LIKE \'{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}solar{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}\')
OR (wp_posts.post_content LIKE \'{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}solar{c573fccdc8da8ca64f5209b77a5c50838319feac11677aba69b682840c09d612}\')
)) AND (wp_posts.post_password = \'\')
AND wp_posts.post_type IN (\'post\', \'roundup\')
AND (wp_posts.post_status = \'publish\')
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC LIMIT 0, 20',
In a query for 20 posts of descending date, where there are 20 posts with matching post titles, those get priority over any posts with matching post_content even if the post_content ones are newer.
There does not appear to be an easy way to limit this search to just post_content, which would be the action that most-closely matches Ken's goal.
The order that WP_Query::parse_search() generates the statement for the search is set as post_title, post_excerpt, post_content.
https://wordpress.stackexchange.com/a/293220 shows a filter that could be used but I'm not sure of how safe it is to implement, whether it works, or whether it's something we'd want to run it in production.
I think he wants title AND content, as opposed to just title
A shorter-time solution might be to:
This would not always be guaranteed to return the desired posts if more than 20 posts have the search term in their post_title.
Why did we remove Load More Posts from this template? That might help solve some of the problem.
Approved by Ken.
:deployed:
Changes
This pull request makes the following changes:
On the Digest page:![Screen Shot 2020-05-13 at 00 04 25](https://user-images.githubusercontent.com/1754187/81770221-a400f280-94ad-11ea-84b3-3fa0b80e1b34.png)
On the homepage, with
.rev
styles:On an article page:
Why
For #100
Testing/Questions
Features that this PR affects:
Questions that need to be answered before merging:
Steps to test this PR: