Support » Themes and Templates » get_sidebar How Can I Make It Dynamic for is_single and is_category??

Viewing 8 replies - 1 through 8 (of 8 total)
  • I guess the only thing I need is an include with the post ID and the post ID’s meta tag for the category.

    In each post I’ll put a key named “sidebar” and the value will be the sidebar number.

    I just don’t know how to write this…..

    Or maybe an easier way would be to put a key as “side” and the value as “/sidebars/sidebarXXX.php” (whichever sidebar corresponds to that post).

    Would that work…? And can someone help with the syntax as I’ve tried 100 ways and I just can’t get it. Started with something that didn’t have a chance…. <?php {include (‘<?php echo get_post_meta($post->ID, “side”, $single = true); ?>’); }
    ?>

    and it didn’t get any better from there….!

    I can’t think of any other angle to go at this. Just tough with my limited coding skills… like mad limited – !

    Any ideas? Many thanks – !

    Is this the correct forum?

    Nobody?

    I figured it out. Took mad long…..

    Justin Tadlock

    (@greenshady)

    WordPress God

    I’m not sure how you ended up doing this, but maybe something like this might work:

    $my_sidebar = get_post_custom_values("sidebar");
    get_sidebar($my_sidebar);

    This would be where your sidebars are named sidebar-1.php, sidebar-2.php, and so on.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘get_sidebar How Can I Make It Dynamic for is_single and is_category??’ is closed to new replies.