Jump to content

Wordpress PHP Question - Include and Meta Data


sole

Recommended Posts

Hello all -! Just found this forum and it rocks - !

 

I have a wordpress 2.5 site I'm working on and I want to do something that I'm having mad problems with. I've made posts on the wordpress forum with no help.

 

Here is what I'm trying to do:

 

I put in a Key and Value when I create a post. I'm trying to call this Key and the Value within this statement:

 

Here is the default:

 

<?php get_sidebar(); ?>

 

I put this in there and it worked great... but... I can't do this as I'll have TONS of pages and the list will be crazy long.

 

 

<?php if (is_single(7)) {include ('sidebars/sidebar5.php'); }

else if (is_single(10)) {include ('sidebars/sidebar3.php'); }

else {include ('sidebars/sidebar.php'); }

?>

 

is_single means it is a post and 7 is the post number.

 

What I setup was a key field named: "side" and put a value of "sidebars/sidebar5.php"  so every page that used sidebar5 I would put in that value.

 

Am I going the wrong way? I've tried all of the code options I could think of... started out with the one below and needless to say it didn't work...!

 

<?php {include ('<?php echo get_post_meta($post->ID, "side", $single = true); ?>'); }?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.