Skip to content

Instantly share code, notes, and snippets.

View chpruckner's full-sized avatar

Christiane Pruckner chpruckner

  • Vienna
View GitHub Profile
@juergensaueregger
juergensaueregger / index.js
Created December 18, 2019 12:43
homework api...
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
const CustomButton = props => {
return <button onClick={props.click}>{props.text}</button>;
};
class App extends React.Component {
constructor(props) {
@krschmidt
krschmidt / head.html
Last active March 2, 2024 20:57
Set Canonical URL via Javascript
<script type='text/javascript'>
var link = !!document.querySelector("link[rel='canonical']") ? document.querySelector("link[rel='canonical']") : document.createElement('link');
link.setAttribute('rel', 'canonical');
link.setAttribute('href', location.protocol + '//' + location.host + location.pathname);
document.head.appendChild(link);
</script>
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>