Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
ethos
tagDiv Member

Sorry guys,
I haven’t needed to look at this forum since the last post. 😉

In belated response:

If you want to set the meta values after a post is created in the normal manner you could use something like this in your theme functions.php file:

add_action( 'save_post', 'ethos_tdc_templates_callback', 20, 1 );

function ethos_tdc_templates_callback($post_id) {

$my_post_type = 'pacnews'; // SET THE POST TYPE YOU WANT TO PROCESS

$post_type = get_post_type($post_id);

if ($my_post_type == $post_type ) {

$tdc_header_template_id = 621; // USE YOUR TEMPLATE ID
$tdc_footer_template_id = 684; // USE YOUR TEMPLATE ID
update_post_meta( $post_id, 'tdc_header_template_id', $tdc_header_template_id );
update_post_meta( $post_id, 'tdc_footer_template_id', $tdc_footer_template_id );
}
}

Hope this helps someone.

ethos
tagDiv Member

Hello,
I was able to resolve this by uninstalling and then reinstalling the TagDiv Composer plugin.

ethos
tagDiv Member

###########################################################
This is posted in case anyone else has the same need to set specific headers for a CPT single page template.

In TagDiv the headers and footers displayed for a post are controlled by entries in the {db-prefix}-postmeta table. In particular, the meta data values for ‘tdc_header_template_id’ and ‘tdc_header_template_id’.

If you create or edit a cloud template take note of the post_id.

In this use case the post is being created programmatically.
The insert is:

$post_id = wp_insert_post(
array(
‘comment_status’ => ‘closed’,
‘ping_status’ => ‘closed’,
‘post_author’ => $author_id,
‘post_name’ => $slug,
‘post_title’ => $title,
‘post_content’ => $content,
‘post_excerpt’ => $excerpt,
‘post_status’ => ‘draft’,
‘post_type’ => ‘my_custom_post_type’,
‘meta_input’ => array(
‘tdc_header_template_id’ => 621, /* use your header template id */
‘tdc_footer_template_id’ => 622, /* use your footer template id */
)
)
);

You could use add_action( ‘wp_insert_post’, ‘my_new_cpt_post_function’) to run ‘update_post_meta’ and update the values.

Hope this helps someone.
Best,
Don

ethos
tagDiv Member

Hi Calin,
Could you please escalate this to the next level.

One of your developers will know the correct “TagDiv way” to set which header / footer is used.

Thank you,
Don

ethos
tagDiv Member

Hi Calin,
Thank you for responding. I am a developer and know about is_page. WordPress has quite good documentation.

I am asking about the function reference for TagDiv. What calls do your developers use to include Newspaper theme specific elements in a page? What calls do we use to specify which header to use? Is there a parameter to set before calling get_header or get_footer.

I have had a brief look at you code and it is difficult to follow since there are three or four areas with very similar templating. I suspect this was exacerbated by you moving templating functionality out of the theme to fit with Envato standards. There must be documentation, or at least someone in your team that knows where everything is. If you don’t have internal documentation, then it is going to be impossible to maintain your code.
If you won’t/can’t help, then so be it. But I’ve dealt with numerous premium plugin authors and all have at least made some effort.

Thank you for your understanding.
Don

ethos
tagDiv Member

Hi Calin,

Thank you for the response.
Can you point me to any documentation of the code calls required in functions.php to call a specific tagdiv header and/or footer?

Or some sample code would be good. 🙂

Thanks,
Don

ethos
tagDiv Member

Hello,
Has there been any progress on this question? Saying it is “a bit tricky to achieve” is not very helpful. I’ve searched the documentation and forums but have not found an answer.
I have the latest version of Newspaper installed with a child theme, use a CPT and need to be able to set custom archive and single template options with specific headers and footers. I have copied single-<CPT-Name>.php file into the child theme and gutted parts to display the CPT content. However, I’d like to be able to use standard TagDiv headers and footers rather than manually rewrite versions of all the header.php and footer.php files.
I don’t mind coding.
If there isn’t a GUI way to call specific headers and footers for a CPT, is there a code reference say, that in the child theme functions.php file if post_type = X then use header Y & footer Z?

Thank you for your help.
Best,
Don

Viewing 7 posts - 1 through 7 (of 7 total)