Jump to content

Hook to modify header.tpl


Recommended Posts

Hello,

 

I want to add the code below to header.tpl

<meta property="fb:app_id" content="{$CFG.fb_app_id}">
<meta property="og:url" content="{$thread.fb_url}" /> 
<meta property="og:title" content="{$thread.fb_title}" /> 
<meta property="og:description" content="{$thread.fb_description}" />
<meta property="og:video" content="https://www.youtube.com/v/{$thread.video}" />
<meta property="og:image" content="{$CFG.siteurl}/photos/{$thread.photo}" />
<meta property="og:image" content="{$CFG.siteurl}/images/{$CFG.fb_image}" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />

 

Is there any way to do it using hooks? I seen in the template a variable $headoutput. Is this something that I can modify eg

$headoutput .= '....................';

 

Thank you

Link to comment
Share on other sites

<?php

function client_custom_headoutput_hook($vars) {

   $head_return = '';
   $head_return = '<meta property="fb:app_id" content="{$CFG.fb_app_id}">
<meta property="og:url" content="{$thread.fb_url}" /> 
<meta property="og:title" content="{$thread.fb_title}" /> 
<meta property="og:description" content="{$thread.fb_description}" />
<meta property="og:video" content="https://www.youtube.com/v/{$thread.video}" />
<meta property="og:image" content="{$CFG.siteurl}/photos/{$thread.photo}" />
<meta property="og:image" content="{$CFG.siteurl}/images/{$CFG.fb_image}" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />';
   return $head_return;
}
add_hook("ClientAreaHeadOutput",1,"client_custom_headoutput_hook");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated