This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'img_post' ); | |
// img_post is name of my thumbnail size ( I've added my own in functions.php ) | |
$focuskw = get_post_meta(get_the_ID(), ‘_yoast_wpseo_focuskw’, true); | |
// It's focus keyword that you enter in Yoast Metabox in post edit page, it's really important | |
$primary_cat = get_post_meta(get_the_ID(), ‘_yoast_wpseo_primary_category’, true); | |
// Primary Category is important, for permalink format and meta keywords | |
if($primary_cat == NULL && $primary_cat == ''){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .forEach() | |
const artists = ['Picasso', 'Kahlo', 'Matisse', 'Utamaro']; | |
artists.forEach(artist => { | |
console.log(artist + ' is one of my favorite artists.'); | |
}); | |
// expected output: | |
// "Picasso is one of my favorite artists." | |
// "Kahlo is one of my favorite artists." | |
// "Matisse is one of my favorite artists." | |
// "Utamaro is one of my favorite artists." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ | |
/* Document | |
========================================================================== */ | |
/** | |
* 1. Correct the line height in all browsers. | |
* 2. Prevent adjustments of font size after orientation changes in iOS. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | |
<title>Students</title> | |
<link rel="stylesheet" href="css/reset.css"> | |
<link rel="stylesheet" href="css/design.css"> | |
<style id="jsbin-css"> | |
body{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(document.body.childNodes[5].childNodes[1]); | |
var titresElts = document.getElementsByTagName("h2"); // Tous les titres h2 | |
console.log(titresElts[0]); // Affiche le premier titre h2 | |
console.log(titresElts.length); // Affiche 3 | |
// Tous les éléments ayant la classe "merveilles" | |
var merveillesElts = document.getElementsByClassName("merveilles"); | |
for (var i = 0; i < merveillesElts.length; i++) { | |
console.log(merveillesElts[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercice : questions de quiz | |
*/ | |
// Liste des questions à afficher. Une question est définie par son énoncé et sa réponse | |
var questions = [ | |
{ | |
enonce: "Combien font 2+2 ?", | |
reponse: "2+2 = 4" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercice : modifier une liste | |
<ul id="desserts"></ul> | |
<button>Ajouter un dessert</button> | |
*/ | |
document.querySelector("button").addEventListener("click", function () { | |
var nomDessert = prompt("Entrez le nom du nouveau dessert :"); | |
var dessertElt = document.createElement("li"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clic() { | |
console.log("Clic !"); | |
} | |
var boutonElt = document.getElementById("bouton"); | |
// Ajout d'un gestionnaire pour l'évènement click | |
boutonElt.addEventListener("click", clic); | |
/*var boutonElt = document.getElementById("bouton"); | |
// Ajout d'un gestionnaire pour l'évènement click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercice : compter les clics | |
*/ | |
function clic() { | |
compteurClics++; | |
document.getElementById("compteurClics").textContent = compteurClics; | |
} | |
var compteurClics = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Changer la couleur des divs : | |
*/ | |
document.addEventListener("keypress", function (e) { | |
var touche = String.fromCharCode(e.charCode); // Récupération de la touche pressée | |
touche = touche.toUpperCase(); // Pour gérer indifféremment minuscules et majuscules | |
var couleur = ""; | |
switch (touche) { | |
case "B": |
NewerOlder