Skip to content

Instantly share code, notes, and snippets.

View taniarascia's full-sized avatar
💾

Tania Rascia taniarascia

💾
View GitHub Profile
@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 / .htaccess
Created July 9, 2015 14:05
Remove .php from filename
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
@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 / sticky.js
Last active August 29, 2015 14:24
Navigation bar under header stick to top on scroll with jQuery
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
$('div').addClass('stickyheader');
} else {
$('div').removeClass('stickyheader');
}
});
@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 / 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 / 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 / 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 / overlay-color-div.css
Created July 25, 2015 04:39
Overlay a color and opacity to a background image
.box {
width:350px;
height:150px;
}
.fade {
position: relative;
}
.fade:after {
@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;