Blog Code Forum

Google Plus One

From Wiki.cyring.fr

(Difference between revisions)
Jump to: navigation, search
(Page créée avec « ===== loop.php ===== <syntaxhighlight lang="javascript"> <div class="entry-utility"> // ... <g:plusone size="small" href="<?php the_permalink(); ?>"></g:plusone> <scrip... »)
(loop.php)
 
(10 intermediate revisions not shown)
Line 1: Line 1:
-
===== loop.php =====
+
== WordPress ==
-
<syntaxhighlight lang="javascript">
+
===== header.php =====
-
<div class="entry-utility">
+
<syntaxhighlight lang="html5">
-
// ...
+
<body <?php body_class(); ?>>
-
<g:plusone size="small" href="<?php the_permalink(); ?>"></g:plusone>
+
...
<script type="text/javascript">
<script type="text/javascript">
 +
</syntaxhighlight>
 +
<syntaxhighlight lang="javascript">
window.___gcfg = {lang: '<?php echo qtrans_getLanguage() ?>'};
window.___gcfg = {lang: '<?php echo qtrans_getLanguage() ?>'};
(function() {
(function() {
Line 12: Line 14:
})();
})();
</script>
</script>
-
// ...
+
...
 +
</syntaxhighlight>
 +
----<br />
 +
===== loop.php =====
 +
<syntaxhighlight lang="html5">
 +
<div class="entry-utility">
 +
...
 +
<?php $oneLink=get_permalink();
 +
if(($langPos=strrpos($oneLink, "?lang=")) != FALSE)
 +
$oneLink=substr($oneLink, 0, $langPos);
 +
?>
 +
<g:plusone size="small" href="<?php echo $oneLink; ?>"></g:plusone>
 +
...
</div><!-- .entry-utility -->
</div><!-- .entry-utility -->
 +
</syntaxhighlight>
 +
----<br />
 +
 +
===== style.css =====
 +
<syntaxhighlight lang="css">
 +
div[id^="___plusone"] {
 +
position: relative !important;
 +
top: 2px !important;
 +
}
 +
</syntaxhighlight><br />
 +
== MediaWiki ==
 +
===== MonoBook.php =====
 +
<syntaxhighlight lang="html5">
 +
<div id="header">
 +
...
 +
<script type="text/javascript">
 +
</syntaxhighlight>
 +
<syntaxhighlight lang="javascript">
 +
(function() {
 +
var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
 +
po.src = "https://apis.google.com/js/plusone.js";
 +
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
 +
})();
 +
</syntaxhighlight>
 +
<syntaxhighlight lang="html5">
 +
</script>
 +
</div>
 +
 +
<div id="column-content"><div id="content">
 +
...
 +
<g:plusone size="small" href="<?php echo $this->data[serverurl] . $this->data['content_actions']['nstab-main']['href']; ?>"></g:plusone>
 +
...
 +
</div></div>
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 13:37, 4 January 2013

Contents

WordPress

header.php
<body <?php body_class(); ?>>
	...
	<script type="text/javascript">
		window.___gcfg = {lang: '<?php echo qtrans_getLanguage() ?>'};
		(function() {
			var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
			po.src = "https://apis.google.com/js/plusone.js";
			var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
		})();
	</script>
...


loop.php
<div class="entry-utility">
	...
	<?php	$oneLink=get_permalink();
		if(($langPos=strrpos($oneLink, "?lang=")) != FALSE)
			$oneLink=substr($oneLink, 0, $langPos);
	?>
	<g:plusone size="small" href="<?php echo $oneLink; ?>"></g:plusone>
	...
</div><!-- .entry-utility -->


style.css
div[id^="___plusone"] {
	position: relative !important;
	top: 2px !important;
}

MediaWiki

MonoBook.php
<div id="header">
	...
	<script type="text/javascript">
		(function() {
			var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;
			po.src = "https://apis.google.com/js/plusone.js";
			var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);
		})();
	</script>
</div>
 
<div id="column-content"><div id="content">
	...
	<g:plusone size="small" href="<?php echo $this->data[serverurl] . $this->data['content_actions']['nstab-main']['href']; ?>"></g:plusone>
	...
</div></div>
Personal tools