WordPress.org

Ready to get started?Download WordPress

Forums

Re-writing template code to include dynamic sidebar and custom sidebar (3 posts)

  1. catwoman2970
    Member
    Posted 3 years ago #

    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.

  2. catwoman2970
    Member
    Posted 3 years ago #

    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.

  3. catwoman2970
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.