Define a specific sidebar using custom fields

Many of you know WordPress will let you create custom sidebar templates using the same file naming method as other templates eg: sidebar-{name}.php. Replacing the get_sidebar() function with this snippet will let you define a custom sidebar for specific posts using custom fields.



$sidebar = get_post_meta($post->ID, "sidebar", true);

Leave a comment