Skip to content

Instantly share code, notes, and snippets.

@albionselimaj
Created February 22, 2018 08:22
Show Gist options
  • Save albionselimaj/f4dc33bbe2dfe9eba7d41838dd36a35f to your computer and use it in GitHub Desktop.
Save albionselimaj/f4dc33bbe2dfe9eba7d41838dd36a35f to your computer and use it in GitHub Desktop.
Hide "Add Listing" button for users with at least one active listing
<?php
add_action( 'wp_enqueue_scripts', function() {
if ( is_user_logged_in() && count_user_posts( get_current_user_id(), 'job_listing' ) >= 1 ) {
wp_add_inline_style( 'theme-styles-default', '.c27-main-header .header-button { display: none !important; }' );
}
}, 500 );
@untilluke
Copy link

Hi,
This is for all the users, how can i do that just for the employer role and NOT for the others?

Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment