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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
//Page Slug Body Class | |
function add_slug_body_class( $classes ) { | |
global $post; | |
if ( isset( $post ) ) { | |
$classes[] = $post->post_type . '-' . $post->post_name; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'add_slug_body_class' ); |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = array( |
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
$segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/')); | |
$numSegments = count($segments); | |
$currentSegment = $segments[$numSegments - 1]; | |
echo 'Current Segment: ' , $currentSegment; |
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
// to update plugins in localhost | |
define('FS_METHOD', 'direct'); |
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
// Add term page | |
function custom_url_taxonomy_add_new_meta_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="term_meta[custom_term_meta]"><?php _e( 'Custom url category', 'custom_url_category' ); ?></label> | |
<input type="text" name="term_meta[custom_term_meta]" id="term_meta[custom_term_meta]" value=""> | |
<p class="description"><?php _e( 'Inserisci un custom url prodotto per la categoria','custom_url_category' ); ?></p> | |
</div> | |
<?php |
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
$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); |
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
CSS | |
.box{ | |
position: relative; | |
width: 50%; /* desired width */ | |
} | |
.box:before{ | |
content: ""; | |
display: block; | |
padding-top: 100%; /* initial ratio of 1:1*/ | |
} |
OlderNewer