Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'init', 'arsh_oxy_condition_author_has_cpt_entry' );
- function arsh_oxy_condition_author_has_cpt_entry() {
- if ( function_exists( 'oxygen_vsb_register_condition' ) ) {
- oxygen_vsb_register_condition(
- 'Author has any entry published',
- array(
- 'options' => array('true', 'false'),
- 'custom' => false
- ),
- array('=='),
- 'is_user_has_published_post',
- 'User'
- );
- }
- }
- function is_user_has_published_post( $value, $operator ) {
- $current_user = wp_get_current_user();
- $args = array(
- 'author' => $current_user->ID,
- 'post_type' => array('opdrachten_personeel', 'opdracht_loonwerk', 'dienstverlen_machver', 'dienstverle_loonwerk', 'dienstverleners_zzp'),
- 'post_status' => 'publish'
- );
- $posts = get_posts($args);
- if ('true' === $value) {
- if ($posts) { return true; }
- }
- if ('false' === $value) {
- if (!$posts) { return true; }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement