The Metabox is saving each value as expected in the database with the content template ID.
e.g. when saving value of content template for "Posts" then the metabox values get saved with the ID of the content template.
I am using following code to get the value of theme options and metaboxes:
1- get the global theme value only if metabox not set.
2- if metabox value is set then it will override the global theme settings value and get the metabox value of the current page.
The Problem is with this code now when using the metabox in a content template that saving the Metabox values for a Content Template this means only if this content template is displayed the theme settings will effect. so i need a way to get the metbaox values of the Template Content of current post so i can display parts of the theme conditionally. this how it should be the final results:
1- if current post metabox values are set then override global theme settings and override content template settings and return.
2- else if metabox of current post are default and metabox values of the content template of current post are not default then return values.
3- else it should return the global values of the global theme settings
priority 1: is to return metabox of current post values
priority 2: is to return metabox values of current content template of current post
priority 3: is to return Global theme settings if first 2 priorities are set to default.
how can i get the metabox values of the current content template of current post?
Christian is not online until later, but I think it would be best if he continued this with you, so let me assign this to Christian who will respond later today.
So it sounds like you need a way to programmatically determine which Content Template is applied to the current post. In Toolset, the Content Template assigned to a post can be determined by examining the postmeta for that post, and finding the value for the hidden custom meta field "_views_template".
// $post is the global post object, or some post ID
$template_id = get_post_meta( $post, '_views_template', true );
Okay great, glad it works. It looks like you're getting the ID of the Content Template correctly based on the post ID and get_post_meta, so I can confirm that much looks good. Good luck with this project!