As I am adding google +1 button and such things, i am getting new stuff to add to my opening html tag. It is a real hassle having to go back and add the new links or piece of code inside the opening html tag.

Can I feed the open html tag through a php file? where I can add whatever new stuff I need to add to it ie

<html itemscope itemtype="http://schema.org/">

etc.

Next question is, if this is possible/allowed, how should I import it? by echo, import... ?

Sample code would be much appreciated please. Thank you!!!

Member Avatar for diafol

you can include or require.

1 Create a new file openhtml.php
2 Insert following line in you HTML <html <?php require_once('openhtml.php');?> >
3 Insert this into php file:

echo' itemscope itemtype="http://schema.org/" ';

4 Done.

1 Create a new file openhtml.php
2 Insert following line in you HTML <html <?php require_once('openhtml.php');?> >
3 Insert this into php file:

echo' itemscope itemtype="http://schema.org/" ';

4 Done.

Wow didn't know I could insert remotely right into the tag itself. Genious!

you can add google+ button with out plug in

by this code

<?php
 
/* Add plusone.js to <head> section of your theme  */
add_action ('wp_enqueue_scripts','google_plusone_script');
 
function google_plusone_script() {
    wp_enqueue_script('google_plus_one', '<a href="https://apis.google.com/js/plusone.js%27" rel="nofollow">https://apis.google.com/js/plusone.js'</a>, array(), null);
}
 
/* Add +one button after your post content by using filter */
 
add_filter('the_content', 'google_plus_one');
 
function google_plus_one($content) {
    $content = $content.'<div class="google_plus_one">
    <g:plusone size="tall" href="'.get_permalink().'"></g:plusone></div>';
    return $content;
}
 
?>

THis might help you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.