0

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!!!

5
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by epixeltechno
0

you can include or require.

Edited by diafol: n/a

0

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.

0

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!

0

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

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.