WordPress.org

Support

Support » Plugins and Hacks » Hacks » Re-writing template code to include dynamic sidebar and custom sidebar

Re-writing template code to include dynamic sidebar and custom sidebar

  • First of all, I indicated that I’m using WP 3.0, but I really don’t know what version this is. I didn’t install this, and I don’t have access to the readme file.

    I’m creating a new template for press release articles. It will be the same as my default page template except I want to include a custom sidebar (called sidebar3.php) along with the dynamic sidebar that currently appears on the default page template. Currently the code in the default template is –

    <?php if(get_post_meta($post->ID, custom_sidebar_value, true) != NULL)
    	{include get_post_meta($post->ID, custom_sidebar_value, $single = true);}
    	else {include('sidebar.php');}
    
     ?>

    We’re using a third-party theme, so I guess this was written by that programmer. So I want the new press release theme to still show the meta stuff and dynamic sidebar PLUS my custom sidebar. I don’t know how to edit php so I’m hoping for some assistance. Thanks, and lmk if I’ve posted in the wrong place.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Also, I don’t need any reference to sidebar.php in the new template. That was something the theme creator added in case there are no widgets in the dynamic sidebar.

    Also, what’s tricky is that I’m trying to pull in the sidebar3 data within the div container that is generated by the if-else php statement so that the data is nicely enclosed in it with the other widgets. I’d rather not add separate css to get the sidebar3 data to align properly. I realize that the following code would work, but again this puts sidebar3 outside the div.

    <?php
    if(get_post_meta($post->ID, custom_sidebar_value, true) != NULL)
    	{include get_post_meta($post->ID, custom_sidebar_value, $single = true);}
    	else {include('sidebar.php');} ?>
    <?php include('sidebar3.php'); ?>

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Re-writing template code to include dynamic sidebar and custom sidebar’ is closed to new replies.