using WP magic to reduce amount of code