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 | |
//PASTE THIS IN FUNCTIONS | |
function my_image($postid=0, $size='thumbnail') { //it can be thumbnail or full | |
if ($postid<1){ | |
$postid = get_the_ID(); | |
} | |
if(has_post_thumbnail($postid)){ | |
$imgpost = wp_get_attachment_image_src(get_post_thumbnail_id($postid), $size); | |
return $imgpost[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
<?php | |
//In function.php | |
function get_post_views($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
return "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
$(document).ready(function(){ | |
var images = ['image1.jpg', 'image2.jpg','image3.jpg']; | |
$('#bg').css({'background-image': 'url(wp-content/themes/mytheme/images/' + images[Math.floor(Math.random() * images.length)] + ')'}); | |
}); |
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 | |
function custom_search_query( $query ) { | |
$custom_fields = array( | |
//agregamos los valores de los custom meta data | |
"_post_title", | |
"custom_meta1", | |
"custom_meta2" | |
); | |
$searchterm = $query->query_vars['s']; | |
$query->query_vars['s'] = ""; |
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
$(document).ready(){ | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if(input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() == '' || input.val() == input.attr('placeholder')) { |
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
if($().nombrePlugin) { | |
// if nombrePLugin is loaded and available | |
} | |
//OR | |
if($.fn.nombrePlugin !== undefined) { | |
// if nombrePLugin is loaded and available | |
} |
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 | |
function lang_support() { | |
return array('en','fr'); | |
// Add your support lang-code (1st place is a default) | |
} | |
function rewrite_lang(){ | |
$langs = lang_support(); | |
foreach($langs as $lang) { |
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 | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php | |
*/ | |
$args = array( | |
//////Author Parameters - Show posts associated with certain author. | |
'author' => '1,2,3,', //(int) - use author id [use minus (-) to exclude authors by ID ex. 'author' => '-1,-2,-3,'] |
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 | |
function basic_wp_seo() { | |
global $page, $paged, $post; | |
$default_keywords = 'wordpress, plugins, themes, design, dev, development, security, htaccess, apache, php, sql, html, css, jquery, javascript, tutorials'; // customize | |
$output = ''; | |
// description | |
$seo_desc = get_post_meta($post->ID, 'mm_seo_desc', true); | |
$description = get_bloginfo('description', 'display'); | |
$pagedata = get_post($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
$(function(){ | |
$('.thediv').click(function(){ | |
window.location = $(this).find('a').attr('href'); | |
}); | |
}) |
OlderNewer