How to force public content via woocommerce memberships based on ACF array valuePass Advanced Custom Fields Through Blog LoopHow to get logged in users membership plan in WooCommerceWooCommerce Memberships: Conditional Restricted Content CheckWordpress, ACF relationship array & Post Expirator plugin weird behavior - items in array get lost somehowWooCommerce Memberships all content older than 2 years make publicWordpress force the_content() to return complete when using WooCommerce MembershipsACF select values into arrayHow do I find what the ID of the required membership is to view a content restricted page with WooCommerce Memberships?Advanced Custom Fields ( ACF ) on WooCommerce CheckoutWooCommerce: ACF value not pulling through product category
French license plates
How many stack cables would be needed if we want to stack two 3850 switches
Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?
Was the ruling that prorogation was unlawful only possible because of the creation of a separate supreme court?
Contour integration with infinite poles
How big would the ice ball have to be to deliver all the water at once?
Isn't the detector always measuring, and thus always collapsing the state?
Worlds with different mathematics and logic
Would allowing versatile weapons wielded in two hands to benefit from Dueling be unbalanced?
Why, even after his imprisonment, do people keep calling Hannibal Lecter "Doctor"?
Top off gas with old oil, is that bad?
Earliest time frog can jump to the other side of a river in C#. Codility's task
Convert a string of digits from words to an integer
Phonetic distortion when words are borrowed among languages
Calculate the Ultraradical
Do my potential customers need to understand the "meaning" of a logo, or just recognize it?
Would an object shot from earth fall into the sun?
Is it possible for a company to grow but its stock price stays the same or decrease?
Looking for circuit board material that can be dissolved
How to compare integers in Tex?
Can an energy drink or chocolate before an exam be useful ? What sort of other edible goods be helpful?
Avoiding dust scattering when you drill
Is it possible to take a database offline when doing a backup using an SQL job?
Impossible violin chord, how to fix this?
How to force public content via woocommerce memberships based on ACF array value
Pass Advanced Custom Fields Through Blog LoopHow to get logged in users membership plan in WooCommerceWooCommerce Memberships: Conditional Restricted Content CheckWordpress, ACF relationship array & Post Expirator plugin weird behavior - items in array get lost somehowWooCommerce Memberships all content older than 2 years make publicWordpress force the_content() to return complete when using WooCommerce MembershipsACF select values into arrayHow do I find what the ID of the required membership is to view a content restricted page with WooCommerce Memberships?Advanced Custom Fields ( ACF ) on WooCommerce CheckoutWooCommerce: ACF value not pulling through product category
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to create a function which will force woocommerce memberships content to be public if an ACF value exists for a certain post.
I was able to create a separate function with the help of a colleague, which checks for this value and applies HTML to the content-single.php template:
<?php $status = get_field('status'); ?>
<?php if( in_array('10', $status) ): ?>
<h2 class="HTML">HTML</h2>
<?php endif; ?>
I also found the woocommerce-memberships function which sets a post as public based on if a checkbox is selected.
public function output( WP_Post $post ) {
$this->post = $post;
?>
<h4><?php esc_html_e( 'Content Restriction', 'woocommerce-memberships' ); ?></h4>
<?php woocommerce_wp_checkbox( array(
'id' => '_wc_memberships_force_public',
'class' => 'js-toggle-rules',
'label' => __( 'Disable restrictions', 'woocommerce-memberships' ),
'description' => __( 'Check this box if you want to force the content to be public regardless of any restriction rules that may apply now or in the future.', 'woocommerce-memberships' ),
) ); ?>
<?php if ( 'yes' === wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true ) ) : ?>hide<?php endif; ?>">
The last line contains the action I'm interested in:
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
I'm not sure how to format this properly, but the goal is to have something like this occur when a post is updated:
/* If 10 is in $status array */
<?php if( in_array('10', $status) ): ?>
/* Then set the post _wc_memberships_force_public value to true */
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
<?php endif; ?>
wordpress advanced-custom-fields woocommerce-memberships
add a comment
|
I'm trying to create a function which will force woocommerce memberships content to be public if an ACF value exists for a certain post.
I was able to create a separate function with the help of a colleague, which checks for this value and applies HTML to the content-single.php template:
<?php $status = get_field('status'); ?>
<?php if( in_array('10', $status) ): ?>
<h2 class="HTML">HTML</h2>
<?php endif; ?>
I also found the woocommerce-memberships function which sets a post as public based on if a checkbox is selected.
public function output( WP_Post $post ) {
$this->post = $post;
?>
<h4><?php esc_html_e( 'Content Restriction', 'woocommerce-memberships' ); ?></h4>
<?php woocommerce_wp_checkbox( array(
'id' => '_wc_memberships_force_public',
'class' => 'js-toggle-rules',
'label' => __( 'Disable restrictions', 'woocommerce-memberships' ),
'description' => __( 'Check this box if you want to force the content to be public regardless of any restriction rules that may apply now or in the future.', 'woocommerce-memberships' ),
) ); ?>
<?php if ( 'yes' === wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true ) ) : ?>hide<?php endif; ?>">
The last line contains the action I'm interested in:
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
I'm not sure how to format this properly, but the goal is to have something like this occur when a post is updated:
/* If 10 is in $status array */
<?php if( in_array('10', $status) ): ?>
/* Then set the post _wc_memberships_force_public value to true */
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
<?php endif; ?>
wordpress advanced-custom-fields woocommerce-memberships
add a comment
|
I'm trying to create a function which will force woocommerce memberships content to be public if an ACF value exists for a certain post.
I was able to create a separate function with the help of a colleague, which checks for this value and applies HTML to the content-single.php template:
<?php $status = get_field('status'); ?>
<?php if( in_array('10', $status) ): ?>
<h2 class="HTML">HTML</h2>
<?php endif; ?>
I also found the woocommerce-memberships function which sets a post as public based on if a checkbox is selected.
public function output( WP_Post $post ) {
$this->post = $post;
?>
<h4><?php esc_html_e( 'Content Restriction', 'woocommerce-memberships' ); ?></h4>
<?php woocommerce_wp_checkbox( array(
'id' => '_wc_memberships_force_public',
'class' => 'js-toggle-rules',
'label' => __( 'Disable restrictions', 'woocommerce-memberships' ),
'description' => __( 'Check this box if you want to force the content to be public regardless of any restriction rules that may apply now or in the future.', 'woocommerce-memberships' ),
) ); ?>
<?php if ( 'yes' === wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true ) ) : ?>hide<?php endif; ?>">
The last line contains the action I'm interested in:
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
I'm not sure how to format this properly, but the goal is to have something like this occur when a post is updated:
/* If 10 is in $status array */
<?php if( in_array('10', $status) ): ?>
/* Then set the post _wc_memberships_force_public value to true */
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
<?php endif; ?>
wordpress advanced-custom-fields woocommerce-memberships
I'm trying to create a function which will force woocommerce memberships content to be public if an ACF value exists for a certain post.
I was able to create a separate function with the help of a colleague, which checks for this value and applies HTML to the content-single.php template:
<?php $status = get_field('status'); ?>
<?php if( in_array('10', $status) ): ?>
<h2 class="HTML">HTML</h2>
<?php endif; ?>
I also found the woocommerce-memberships function which sets a post as public based on if a checkbox is selected.
public function output( WP_Post $post ) {
$this->post = $post;
?>
<h4><?php esc_html_e( 'Content Restriction', 'woocommerce-memberships' ); ?></h4>
<?php woocommerce_wp_checkbox( array(
'id' => '_wc_memberships_force_public',
'class' => 'js-toggle-rules',
'label' => __( 'Disable restrictions', 'woocommerce-memberships' ),
'description' => __( 'Check this box if you want to force the content to be public regardless of any restriction rules that may apply now or in the future.', 'woocommerce-memberships' ),
) ); ?>
<?php if ( 'yes' === wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true ) ) : ?>hide<?php endif; ?>">
The last line contains the action I'm interested in:
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
I'm not sure how to format this properly, but the goal is to have something like this occur when a post is updated:
/* If 10 is in $status array */
<?php if( in_array('10', $status) ): ?>
/* Then set the post _wc_memberships_force_public value to true */
wc_memberships_get_content_meta( $post, '_wc_memberships_force_public', true )
<?php endif; ?>
wordpress advanced-custom-fields woocommerce-memberships
wordpress advanced-custom-fields woocommerce-memberships
asked Mar 28 at 19:50
adbeadbe
207 bronze badges
207 bronze badges
add a comment
|
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405813%2fhow-to-force-public-content-via-woocommerce-memberships-based-on-acf-array-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405813%2fhow-to-force-public-content-via-woocommerce-memberships-based-on-acf-array-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown