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
UPDATE wp_posts p | |
LEFT JOIN wp_postmeta pm ON p.ID=pm.post_id | |
SET | |
p.post_type='new_post_type', | |
p.guid=REPLACE(p.guid, 'old_post_type', 'new_post_type') | |
WHERE | |
p.post_type='old_post_type' |
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 | |
$post_type = 'post'; // post, page, custom_post_type | |
if (function_exists('wpp_get_mostpopular')) { | |
add_filter('wpp_html', 'wpp_get_array', 10, 2); | |
function wpp_get_array($content, $posts_data) { | |
$id = 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
# BEGIN TimThumb .htaccess | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteCond %{REQUEST_URI} (?i)(jpg|jpeg|png|gif)$ | |
RewriteCond %{QUERY_STRING} h=([1-9]) [OR] | |
RewriteCond %{QUERY_STRING} w=([1-9]) | |
RewriteRule (.*) ./path/to/timthumb.php?src=%{REQUEST_URI}&%{QUERY_STRING} | |
</IfModule> | |
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
var number = 10000000.00; | |
if (window.Intl && typeof window.Intl === "object") { | |
numberFormatted = new Intl.NumberFormat("es-VE", {minimumFractionDigits: 2}).format(number); | |
} else { | |
// fallback if Intl is not supported | |
numberFormated = number; | |
} | |
alert(numberFormatted); |
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 jpb_change_user_pass() { | |
$old_pass = filter_input(INPUT_POST, 'old_pass'); | |
$new_pass = filter_input(INPUT_POST, 'new_pass'); | |
$new_pass_verify = filter_input(INPUT_POST, 'new_pass_verify'); | |
if (empty($old_pass) or empty($new_pass) or $new_pass != $new_pass_verify or !is_user_logged_in()) { | |
return; |
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_logout() { | |
$logout = (bool) filter_input(INPUT_GET, 'logout'); | |
if ($logout) { | |
wp_logout(); | |
echo '<script type="text/javascript">window.location = "' . home_url() . '";</script>'; | |
} | |
} |
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 jpb_login() { | |
$user_login = filter_input(INPUT_POST, 'user_login'); | |
$user_password = filter_input(INPUT_POST, 'user_password'); | |
$remember = (bool) filter_input(INPUT_POST, 'remember'); | |
if (!empty($user_login) && !empty($user_password)) { | |
$creds = array(); | |
$creds['user_login'] = $user_login; |
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 | |
$term_id = (int) get_query_var('cat'); | |
$current_term = get_term($term_id, 'category'); | |
if ($current_term->parent !== 0) { | |
$is_parent = FALSE; | |
while (!$is_parent) { | |
$current_term = get_term($current_term->parent, 'category'); | |
if ($current_term->parent == 0) { | |
$is_parent = TRUE; |
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 jpb_register_meta_box() { | |
if (!class_exists('RW_Meta_Box') or !is_admin()) { | |
return; | |
} | |
$post_id = $current_post = false; |
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
// verify that this is a product category page | |
if (is_product_category()){ | |
global $wp_query; | |
// get the query object | |
$cat = $wp_query->get_queried_object(); | |
// get the thumbnail id user the term_id | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
// get the image URL | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
// print the IMG HTML |
OlderNewer