Trying to add a right-hand column to posts to display on certain categories in WordPress. (In this instance, when posting a job vacancy under the category 'vacancies' I want a right hand column to be featuring job specs/details.
Any idea how I can achieve this?
You may achieve this adding some logic to functions.php
:
Use in_category( 'vacancies', get_the_ID() )
to determine if the current post holds the wanted category, and then use wp_nav_menu()
to display the wanted menu:
wp_nav_menu( array( 'theme_location' => 'Vacancies menu' );
Your first have to register your custom menu. See codex for details on how to do it: https://codex.wordpress.org/Function_Reference/register_nav_menus
The complete code would look something like:
<?php
if ( is_single() && in_category( 'vacancies', get_the_ID() ) ):
wp_nav_menu( array( 'theme_location' => 'Vacancies menu' );
else:
wp_nav_menu( array( 'theme_location' => 'Standard menu' );
endif;
?>