Skip to content
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

hide social previews if not premium #70

Merged
merged 7 commits into from
Jun 21, 2021

Conversation

jazzsequence
Copy link
Contributor

This PR does some cleanup of Yoast loading code -- it's actually not in our best interest to spoof Yoast Premium because it changes the labels to say that Yoast SEO Premium is active.

It adds a helper function that is used here and can be used later (e.g. with #59) to determine if Yoast Premium is active, and then uses that function to load styles that conditionally hide the social previews if Premium is not active.

Fixes #69

this can be used by a bunch of things to enable/disable features
premium overrides free version.
in fact it leads to problems with labelling & makes things appear that Premium is active when it's actually not
prevents the social tab from displaying in the yoast metabox if Yoast Premium is inactive
@jazzsequence jazzsequence self-assigned this Jun 21, 2021
we're hard-coding what's going into the echo here with no possibility of outside insertions.
* preview buttons. If Yoast ever adds more panels to this sidebar,
* this will need to be updated.
*/
$styles = 'div.components-panel div:nth-child(6n) div.yoast.components-panel__body, div.components-panel div:nth-child(7n) div.yoast.components-panel__body {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good future update might be to ask if they can provide hooks to switch these on/off, or at least provide CSS class names for these items.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this feels super hacky. The other option was disabling the inner elements that do have classes, but the border-bottom is on the wrapping container, so you ended up with an extra thick border under the Google preview button.

@roborourke
Copy link
Contributor

If someone does install Yoast premium will our installer overrides place it in vendor or does it have a different package name?

@jazzsequence
Copy link
Contributor Author

If someone does install Yoast premium will our installer overrides place it in vendor or does it have a different package name?

It should be wordpress-seo-premium so it would install separately.

@jazzsequence jazzsequence merged commit b15148e into master Jun 21, 2021
@jazzsequence jazzsequence deleted the 69-hide-social-previews-if-not-premium branch June 21, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Yoast SEO social previews are blank without premium
2 participants