Skip to content

Instantly share code, notes, and snippets.

View taniarascia's full-sized avatar
💾

Tania Rascia taniarascia

💾
View GitHub Profile
@taniarascia
taniarascia / thumbnail-function.php
Last active August 29, 2015 14:26
Force uploaded media to create a certain thumbnail size
// Add 250 x 250 thumbnail to every image uploaded
add_image_size( 'gallery-thumbnail', 250, 250, true );
// gallery_thumbnail is a custom size! It can have any name.
// Call it later in a gallery loop.
<section id="gallery_page">
<ul class="gal columns-4">
<?php
$args = array(
@taniarascia
taniarascia / modal.php
Last active February 13, 2024 07:53
Create modal popup
$(function(){
$("#modal-launcher, #modal-background, #modal-close").click(function () {
$("#modal-content,#modal-background").toggleClass("active");
});
});
#modal-background {
display: none;
position: fixed;
top: 0;
@taniarascia
taniarascia / page-loop.php
Created July 29, 2015 16:18
Display a particular page's loop
<?php $my_query = new WP_Query('page_id=87');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID;?>
<div class="entry">
<?php the_content('read more &raquo;'); ?>
</div>
@taniarascia
taniarascia / custom-admin-area.php
Created July 29, 2015 18:26
function.php add custom admin are
// Create custom admin area
add_action('admin_menu', 'add_leye_interface');
function add_leye_interface() {
add_options_page('LEYE Custom Fields', 'LEYE Custom Fields', '8', 'functions', 'editleyecustomfields');
}
function editleyecustomfields() {
?>
<div class='wrap'>
@taniarascia
taniarascia / dropdown.js
Created August 5, 2015 21:20
Enable Dropdown Navigation
;
(function ($) {
// DOM ready
$(function () {
// Toggle open and close nav styles on click
$('#nav-toggle').click(function () {
@taniarascia
taniarascia / post-id.php
Created August 5, 2015 22:08
When all else fails with custom content
if($post->ID == '4331') {} else {}
@taniarascia
taniarascia / no-qp.php
Created August 26, 2015 20:58
Pull without query_posts
$args = array(
'post_type' => 'post-custom',
'order' => 'ASC',
'posts_per_page' => -1,
'fields' => 'ids'
);
$post_ids = get_posts( $args );
foreach ( $post_ids as $id ) {
$meta = get_post_meta( $id, '_my_meta', true );
@taniarascia
taniarascia / featured.php
Created September 1, 2015 22:09
Featured Image
@taniarascia
taniarascia / custom-post.php
Created September 1, 2015 22:09
Correct Way to Pull From a Custom Loop
<?php get_header(); ?>
<?php $featured_image = wp_get_attachment_url(get_post_thumbnail_id($page->ID));
if (have_posts()) : while (have_posts()) : the_post();
?>
<div class="container" id="services_container">
<img src="<?php echo $featured_image;?>" class="left_image">
<div class="left_box">
<h2><?php the_title();?></h2>
<p>
<?php the_content();?>
@taniarascia
taniarascia / redirect.php
Last active September 4, 2015 20:26
Permanent PHP Redirect
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.new.com");
?>