-
-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the featured media to the two-column classic post #1140
Conversation
…run to deduplicate hero images
In testing, many two-column sites will have used a different featured image from the beginning-of-story image. This function doesn't do anything to prevent two images next to each other at the beginning of the story. It just prevents two identical images next to each other. We should discuss how to handle the two-adjacent-images situation. It might need to be on a per-site. |
…the global $post is not set (occurs when running tests, may occur elsewhen)
* | ||
* @since 0.4 - in Largo's single-column template | ||
* @since 0.5.5 - in Largo's two-column template | ||
* | ||
* @param String $content the post content passed in by WordPress filter | ||
* @return String filtered post content. | ||
*/ | ||
function largo_remove_hero($content) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the default be to run this or not run it? seems like maybe a decision that would need to be made by each site, individually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default is currently to run it (in single-column posts), so if we changed the default, it would affect many sites in production.
For sites that are moving to Largo, they can definitely make the decision at migration time, which is why the filter was added.
@@ -239,9 +283,9 @@ function largo_url_to_attachmentid($url) { | |||
* @filter largo_partial_by_post_type | |||
* @since 0.5.4 | |||
*/ | |||
function largo_get_partial_by_post_type($partial, $post_type, $context) { | |||
function largo_get_partial_by_post_type( $partial, $post_type, $context ) { | |||
// Remove this conditional in #926. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be safely removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik #926 is already complete, do you see anywhere where this is still an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inc/ajax-functions.php:195: // argolinks post type
inc/ajax-functions.php:196: $partial = ( get_post_type() == 'argolinks' ) ? 'argolinks' : $partial;
inc/post-templates.php:288: if ( $post_type == 'argolinks' ) {
inc/post-templates.php:289: $partial = 'argolinks';
tests/inc/test-ajax-functions.php:66: // @todo find way to test get_post_type() returning argolinks.
tests/inc/test-ajax-functions.php:115: // @todo find way to test get_post_type() returning argolinks.
Some docs, some LMP partial stuff. It's not actually that big a problem.
Merge conflicts now resolved. |
do we know why test_insert_image_no_thumb is failing? |
No, I don't. |
|
||
$p = explode("\n",$content); | ||
$p = explode( '\n', $content ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the reason the tests are now failing: This needs to be double quotes, to get the explode to work on newlines.
…imploding of paragraphs.
One of the "code style" commits replaced The prominence term update test failures have been around since we merged #1116, I believe. We can't rerun those test unless we un-delete the branch, though. The "array to string conversion" and "called statically" errors under PHP 5.5 are also known, and require building a PHP 5.5 testing environment to fix. INN/deploy-tools#41 PHP 5.5 is used by WPEngine and PHP 5.3 is now 19 months past end of life. |
Changes
largo_hero
call and the after-hero action from the single-column template.hero
styles from thebody.normal
selector, and sets them with no parent selector inless/inc/single.less
largo_remove_hero
run against them to prevent duplicate hero images in the event that the featured media image is the same as the image in the first paragraph of the storylargo_remove_hero
(and docs) that allow themes/plugins to preventlargo_remove_hero
from removing duplicate heroes in posts. Passes the$post
to the filtering function as well.largo_remove_hero
from running if global$post
is unset, because the function requires access to the global$post
. This was problematic because the tests forlargo_excerpt
were running with a post ID but not setting a global$post
. Since the test forlargo_excerpt
are designed to test that function and notlargo_remove_hero
, this PR fixeslargo_remove_hero
and not the test.inc/post-templates.php
, including docs for the conditions in whichlargo_remove_hero
should return the original content passed to it. Does not write any new tests.Things this does not change yet:
This is
a Work In Progress pull requestfor #934, copying the code written for CC-5 into Largo for its eventual merge. We weren't doing this in Largo right then because of the need to check this against other child themes.