Skip to content

Instantly share code, notes, and snippets.

View taniarascia's full-sized avatar
💾

Tania Rascia taniarascia

💾
View GitHub Profile
@taniarascia
taniarascia / memory-0.1.js
Last active April 22, 2024 04:44
Memory Game Tutorial
const cardsArray = [ /* ... */ ];
const game = document.getElementById('game');
const grid = document.createElement('section');
grid.setAttribute('class', 'grid');
game.appendChild(grid);
cardsArray.forEach(item => {
const card = document.createElement('div');
card.classList.add('card');
@taniarascia
taniarascia / index.html
Last active April 3, 2024 21:05
HTML Skeleton file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
@taniarascia
taniarascia / .htaccess
Created July 9, 2015 14:05
Remove .php from filename
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
@taniarascia
taniarascia / .htaccess
Last active February 13, 2024 07:54
Fix .svg broken links in server
AddType image/svg+xml svg
AddType image/svg+xml svgz
@taniarascia
taniarascia / toggle.js
Last active February 13, 2024 07:54
Toggle navigation with jQuery
function toggleNav() {
if ($('#wrapper').hasClass('show-nav')) {
// Do things on Nav Close
$('#wrapper').removeClass('show-nav');
} else {
// Do things on Nav Open
$('#wrapper').addClass('show-nav');
}
//$('#wrapper').toggleClass('show-nav');
}
@taniarascia
taniarascia / wp-main.php
Last active February 13, 2024 07:54
Common Wordpress queries
/*
the_ and get_the are two different queries. For example, the_title(); will echo out the title field into your HTML document, and get_the_title(); can be inserted into a value.
*/
<?php the_title(); ?> // Title
<?php the_content(); ?> // Full entry
<?php the_excerpt(); ?> // Partial entry
<?php the_permalink(); ?> // Calls a specific link
<?php the_category(); ?> // Calls the category
@taniarascia
taniarascia / echo-page-content.php
Last active February 13, 2024 07:54
Post the contents of one page on another page
<?php
$include = get_pages('include=6'); // Insert page number here
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>
@taniarascia
taniarascia / random-image.php
Last active February 13, 2024 07:54
Call random image
<?php
$random = rand(0, 2);
$picture = array(
'pic.jpg',
'other-pic.png',
'something.gif'
);
?>
<img src="<?php echo $picture[$random];?>"></a>
@taniarascia
taniarascia / click-function.js
Created July 16, 2015 20:49
Call a function with a click event with jQuery
$(function() {
$('.classname').click(function() {
// Calling a function in case you want to expand upon this.
clickFunction();
});
});
@taniarascia
taniarascia / functions.php
Created July 27, 2015 18:32
Add meta to regular page post
// register your custom meta box
function my_slider_properties_meta_box() {
add_meta_box('my_slider_properties', 'Link Format Title URL', 'my_slider_properties', 'page', 'side', 'default');
}
add_action('add_meta_boxes', 'my_slider_properties_meta_box');
// echo your custom meta box
function my_slider_properties() {
global $post;