How to filter custom fields?
-
I’m using cubepoints. It has a module named “paid content”. Paid content module hides the post content. User need to pay “X” points to view the page. But this module only hides main content. I mean it hides the content whatever “the_content” loop calls.
This is the code that hides the_content data.
add_filter( “the_content”, “cp_module_pcontent_post_content” );
function cp_module_pcontent_post_content($content){
global $post;
global $cp_module_pcontent_hide;
if(!in_array($post->ID,(array)$cp_module_pcontent_hide)){
return $content;
}
$c = ‘<p>’ . get_option(‘cp_module_pcontent_text_pay’) . ‘</p>’;
$c .= apply_filters(‘cp_module_pcontent_post_content_’.$post->ID, ”);
$c .= ‘<form method=”post”>’;
$c .= ‘<input type=”hidden” name=”cp_module_pcontent_pay” value=”‘.$post->ID.'” />’;
$c .= ‘<p><input type=”submit” value=”‘.get_option(‘cp_module_pcontent_text_button’).'” /></p>’;
$c .= ‘</form>’;
if(!is_user_logged_in()){
$c = get_option(‘cp_module_pcontent_text_logout’);
}
$c = str_replace(‘%points%’,cp_formatPoints(get_post_meta($post->ID,’cp_pcontent_points’, 1)),$c);
return $c;
}Here is my problem. I’m using magic fields plugin. It is a plugin to create custom fields.
So my site doesn’t use the_content loop.For example this is the code my theme using instead of the_content loop.
<?php if (function_exists(‘get_field’)) {
$requirements = get_field(‘requirements_requirements’);
if($requirements){
foreach($requirements as $requirement){
echo $requirement;
}
}
} ?>I want to hide those requirements .
To hide those requirements I need to replace
add_filter( “the_content”, “cp_module_pcontent_post_content” );
to
add_filter( “xxxxxxxx”, “cp_module_pcontent_post_content” );
Can anyone tell me what is that
xxxxxxxx
Thanks
- The topic ‘How to filter custom fields?’ is closed to new replies.