(a) (1) This subsection does not apply to a candidate for:
(i) President or Vice President of the United States; or
(ii) any federal office who seeks nomination by petition.
(2) Unless the individual is a registered voter affiliated with the political party, an individual may not be a candidate for:
(i) an office of that political party; or
(ii) except as provided in subsection (b) of this section, nomination by that political party.
(b) The requirements for party affiliation specified under subsection (a) of this section do not apply to a candidate for:
(1) a judicial office; or
(2) a county board of education.