WP Member and ACF Field
-
Hello,
could you help me at a problem? I use a ACF Field (Downloads) on a page, which should protected by wp members. Plugin protect the page (which included the acf field) but not the acf field by itself. How can I do this? Maybe with???:
<?php
if ( is_user_logged_in() ) {
the_field(‘field_name’);
}
?>This is the code I use:
<h2 class=”icon-download”>Downloads</h2>
<?php if(get_field(“downloads”)): ?>
<div class=”cf mbottom30″> <br clear=”left” />
<ul class=”artikel-downloads”>
<?php while(the_flexible_field(“downloads”)): ?>
<?php if(get_row_layout() == ‘flexibel_download’): // layout: Content ?>
<?php $attachment_id = get_sub_field(‘datei’);
$url = wp_get_attachment_url( $attachment_id );
$title = get_the_title( $attachment_id );
// part where to get the filesize
$filesize = filesize( get_attached_file( $attachment_id ) );
$filesize = size_format($filesize, 2);
?>
<li class=”cf”> ” class=”cf”><?php echo $title; ?> <small>
<!– show filesize –>
<?php echo $filesize; ?></small>
<?php endif; endwhile; ?></div>
<?php endif; ?>How can I protect this ACF-Field??? Is there a solution?
Thank you for your help
Greetings
Steph
The topic ‘WP Member and ACF Field’ is closed to new replies.