Last active
August 20, 2021 13:50
-
-
Save artes-visuales/5b01100dff94ea1933e4 to your computer and use it in GitHub Desktop.
WordPress
This file contains hidden or 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
//Theme Structure | |
header.php ...................... Header Section | |
index.php ......................... Main Section | |
sidebar.php .................... Sidebar Section | |
single.php ....................... Post Template | |
page.php ......................... Page Template | |
comments.php .................. Comment Template | |
search.php ...................... Search Content | |
searchform.php ............ Search Form Template | |
archive.php ................... Archive Template | |
functions.php ................ Special Functions | |
404.php .................... Error Page template | |
style.css .......................... Style Sheet |
This file contains hidden or 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
is_sticky() |
This file contains hidden or 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 get_links_list(); ?> |
This file contains hidden or 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 wp_get_archives() ?> |
This file contains hidden or 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 wp_tag_cloud(); ?> |
This file contains hidden or 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 wp_list_pages(); ?> |
This file contains hidden or 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 next_post_link() ?> |
This file contains hidden or 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 previous_post_link() ?> |
This file contains hidden or 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 posts_nav_link(); ?> |
This file contains hidden or 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 get_calendar(); ?> |
This file contains hidden or 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 get_calendar(); ?> |
This file contains hidden or 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 wp_list_cats(); ?> |
This file contains hidden or 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 the_category() ?> |
This file contains hidden or 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 the_content() ?> |
This file contains hidden or 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 echo c2c_custom('test');?> |
This file contains hidden or 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 the_date() ?> |
This file contains hidden or 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 edit_post_link(__('Edit Post')); ?> |
This file contains hidden or 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 the_excerpt() ?> |
This file contains hidden or 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 wp_loginout();?> |
This file contains hidden or 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 the_ID(); ?> |
This file contains hidden or 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 the_title() ?> |
This file contains hidden or 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 wp_register();?> |
This file contains hidden or 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 the_time() ?> |
This file contains hidden or 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 the_permalink() ?> |
This file contains hidden or 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 | |
// Limpiar el head | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'feed_links', 2); | |
remove_action('wp_head', 'index_rel_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'feed_links_extra', 3); | |
remove_action('wp_head', 'start_post_rel_link', 10, 0); | |
remove_action('wp_head', 'parent_post_rel_link', 10, 0); | |
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0); | |
// Fin limpiar el head | |
//Add css to wp_head | |
function child_theme_head_css(){ | |
wp_enqueue_style('animate', get_bloginfo('stylesheet_directory').'/assets/css/animate.css','style-theme'); | |
wp_enqueue_style('glyphicon', get_bloginfo('stylesheet_directory').'/assets/css/glyphicon.css','style-theme'); | |
} | |
add_action('wp_print_styles', 'child_theme_head_css'); | |
// Logo personalizado en la página de login | |
function custom_login() { | |
echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('stylesheet_directory').'/wp-admin.css" />'; | |
} | |
add_action('login_head', 'custom_login'); | |
// Personalización de administración | |
// css personalizado en la página de login | |
add_action('admin_head', 'my_custom_css'); | |
function my_custom_css() { | |
echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('stylesheet_directory').'/wp-admin.css" />'; | |
} | |
//Quita el acceso al Escritorio al que no sea Admin | |
add_filter('login_redirect', 'dashboard_redirect'); | |
function dashboard_redirect($url) { | |
global $current_user; | |
get_currentuserinfo(); | |
$level = (int) $current_user->wp_user_level; | |
if ( $level < 10 && $level > 3 ) { | |
$url = 'wp-admin/post-new.php'; | |
} | |
return $url; | |
} | |
// url personalizada en la página de login | |
function h1_custom_url(){ | |
return (bloginfo( 'wpurl' )); | |
} | |
add_filter('login_headerurl', 'h1_custom_url'); | |
// Cambiar el pie de pagina del panel de Administración | |
function change_footer_admin() { | |
echo '(c) 2013 Copyright. Todos los derechos reservados - Web creada por <a href="#">artesvisuales</a>'; | |
} | |
add_filter('admin_footer_text', 'change_footer_admin'); | |
//miniaturas en admin de entradas | |
if ( !function_exists('fb_AddThumbColumn') && function_exists('add_theme_support') ) { | |
// para entrada y página | |
add_theme_support('post-thumbnails', array( 'post', 'page' ) ); | |
function fb_AddThumbColumn($cols) { | |
$cols['thumbnail'] = __('Miniatura'); | |
return $cols; | |
} | |
function fb_AddThumbValue($column_name, $post_id) { | |
$width = (int) 45; | |
$height = (int) 45; | |
if ( 'thumbnail' == $column_name ) { | |
// miniatura de WP 2.9 | |
$thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true ); | |
// imagen de la galería | |
$attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') ); | |
if ($thumbnail_id) | |
$thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true ); | |
elseif ($attachments) { | |
foreach ( $attachments as $attachment_id => $attachment ) { | |
$thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true ); | |
} | |
} | |
if ( isset($thumb) && $thumb ) { | |
echo $thumb; | |
} else { | |
echo __('Ninguna'); | |
} | |
} | |
} | |
// para entradas | |
add_filter( 'manage_posts_columns', 'fb_AddThumbColumn' ); | |
add_action( 'manage_posts_custom_column', 'fb_AddThumbValue', 10, 2 ); | |
// para páginas | |
add_filter( 'manage_pages_columns', 'fb_AddThumbColumn' ); | |
add_action( 'manage_pages_custom_column', 'fb_AddThumbValue', 10, 2 ); | |
} | |
//Bloquear el mensaje de error en la entrada de administración | |
add_filter('login_errors',create_function('$a', "return null;")); | |
// Fin personalización de administración | |
/* Modo mantenimiento | |
function wpr_maintenace_mode() { | |
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) { | |
die('Estamos de mantenimiento, no tardes en volver que enseguida terminamos.'); | |
} | |
} | |
add_action('get_header', 'wpr_maintenace_mode'); */ | |
// Theme the TinyMCE editor | |
// You should create custom-editor-style.css in your theme folder | |
//add_editor_style('custom-editor-style.css'); | |
// Insertar Breadcrumb | |
function the_breadcrumb() { | |
if (!is_home()) { | |
echo '<span class="removed_link" title="'; | |
echo get_option('home'); | |
echo '">'; | |
bloginfo('name'); | |
echo "</span> » "; | |
if (is_category() || is_single()) { | |
the_category('title_li='); | |
if (is_single()) { | |
echo " » "; | |
the_title(); | |
} | |
} elseif (is_page()) { | |
echo the_title(); | |
} | |
} | |
} | |
// fin breadcrumb | |
// Avatar image con hCard-compliant photo class | |
function commenter_link() { | |
$commenter = get_comment_author_link(); | |
if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) { | |
$commenter = ereg_replace( '(<a[^>]* class=[\'"]?)', '\\1url ' , $commenter ); | |
} else { | |
$commenter = ereg_replace( '(<a )/', '\\1class="url "' , $commenter ); | |
} | |
$avatar_email = get_comment_author_email(); | |
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 50 ) ); | |
echo $avatar . ' <span class="fn n">' . $commenter . '</span>'; | |
} | |
// end commenter_link | |
//Desactivar revisiones | |
function disable_autosave() { | |
wp_deregister_script('autosave'); | |
} | |
add_action('wp_print_scripts','disable_autosave'); | |
//Fin desactivar revisiones | |
//Añadir gestor de enlaces | |
add_filter( 'pre_option_link_manager_enabled', '__return_true' ); | |
//WOOCOMMERCE | |
// Override theme default specification for product # per row | |
function loop_columns() { | |
return 3; // 3 products per row | |
} | |
add_filter('loop_shop_columns', 'loop_columns', 999); | |
// Mostrar Post ID, Page ID, Media ID, Links ID, Category ID, Tag ID and User ID | |
if ( ! function_exists( 'catchids_column' ) ): | |
/** | |
* Prepend the new column to the columns array | |
*/ | |
function catchids_column($cols) { | |
$column_id = array( 'catchids' => __( 'ID', 'catch-ids' ) ); | |
$cols = array_slice( $cols, 0, 1, true ) + $column_id + array_slice( $cols, 1, NULL, true ); | |
return $cols; | |
} | |
endif; // catchids_column | |
if ( ! function_exists( 'catchids_value' ) ) : | |
/** | |
* Echo the ID for the new column | |
*/ | |
function catchids_value( $column_name, $id ) { | |
if ( 'catchids' == $column_name ) { | |
echo $id; | |
} | |
} | |
endif; // catchids_value | |
if ( ! function_exists( 'catchids_return_value' ) ) : | |
function catchids_return_value( $value, $column_name, $id ) { | |
if ( 'catchids' == $column_name ) { | |
$value .= $id; | |
} | |
return $value; | |
} | |
endif; // catchids_return_value | |
if ( ! function_exists( 'catchids_css' ) ) : | |
/** | |
* Output CSS for width of new column | |
*/ | |
function catchids_css() { | |
?> | |
<style type="text/css"> | |
#catchids { | |
width: 80px; | |
} | |
</style> | |
<?php | |
} | |
endif; // catchids_css | |
add_action( 'admin_head', 'catchids_css'); | |
if ( ! function_exists( 'catchids_add' ) ) : | |
/** | |
* Actions/Filters for various tables and the css output | |
*/ | |
function catchids_add() { | |
// For Media Management | |
add_action( "manage_media_columns" , 'catchids_column' ); | |
add_filter( "manage_media_custom_column" , 'catchids_value' , 10 , 3 ); | |
// For Link Management | |
add_action( 'manage_link_custom_column', 'catchids_value', 10, 2 ); | |
add_filter( 'manage_link-manager_columns', 'catchids_column' ); | |
// For Category Management | |
add_action( 'manage_edit-link-categories_columns', 'catchids_column' ); | |
add_filter( 'manage_link_categories_custom_column', 'catchids_return_value', 10, 3 ); | |
// For Category, Tags and other custom taxonomies Management | |
foreach( get_taxonomies() as $taxonomy ) { | |
add_action( "manage_edit-${taxonomy}_columns" , 'catchids_column' ); | |
add_filter( "manage_${taxonomy}_custom_column" , 'catchids_return_value' , 10 , 3 ); | |
if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) { | |
add_filter( "manage_edit-${taxonomy}_sortable_columns" , 'catchids_column' ); | |
} | |
} | |
foreach( get_post_types() as $ptype ) { | |
add_action( "manage_edit-${ptype}_columns" , 'catchids_column' ); | |
add_filter( "manage_${ptype}_posts_custom_column" , 'catchids_value' , 10 , 3 ); | |
if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) { | |
add_filter( "manage_edit-${ptype}_sortable_columns" , 'catchids_column' ); | |
} | |
} | |
// For User Management | |
add_action( 'manage_users_columns', 'catchids_column' ); | |
add_filter( 'manage_users_custom_column', 'catchids_return_value', 10, 3 ); | |
if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) { | |
add_filter( "manage_users_sortable_columns" , 'catchids_column' ); | |
} | |
// For Comment Management | |
add_action( 'manage_edit-comments_columns', 'catchids_column' ); | |
add_action( 'manage_comments_custom_column', 'catchids_value', 10, 2 ); | |
if( version_compare($GLOBALS['wp_version'], '3.0.999', '>') ) { | |
add_filter( "manage_edit-comments_sortable_columns" , 'catchids_column' ); | |
} | |
} | |
endif; // catchids_add | |
add_action( 'admin_init', 'catchids_add' ); | |
?> |
This file contains hidden or 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 bloginfo('html_type'); ?> |
This file contains hidden or 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 comments_popup_link(); ?> |
This file contains hidden or 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 wp_meta();?> |
This file contains hidden or 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
User-agent: * | |
Disallow: /wp-admin/ | |
Allow: /wp-admin/admin-ajax.php | |
Allow: /wp-content/themes/ | |
Allow: /wp-content/plugins/ | |
Allow: /wp-content/uploads/ | |
Allow: /wp-includes/css/ | |
Allow: /wp-includes/js/ | |
Allow: /wp-includes/images/ |
This file contains hidden or 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 bloginfo('url'); ?> |
This file contains hidden or 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 query_posts('category_name=Category&showposts=10'); ?> | |
<?php while (have_posts()) : the_post(); ?> | |
// The Stuff... Custom HTML & PHP Code | |
<?php endwhile;?> |
This file contains hidden or 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 bloginfo('charset'); ?> |
This file contains hidden or 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 bloginfo('description'); ?> |
This file contains hidden or 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 bloginfo('pingback_url'); ?> |
This file contains hidden or 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 bloginfo('rss2_url'); ?> |
This file contains hidden or 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 bloginfo('stylesheet_url'); ?> |
This file contains hidden or 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 bloginfo('template_url'); ?> |
This file contains hidden or 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 if(have_posts());?> | |
<?php while(have_posts()); the_post();?> | |
// The Stuff... Custom HTML & PHP Code | |
<?php else;?> | |
<?php endif;?> |
This file contains hidden or 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
/* | |
Theme Name: Wordpress | |
Theme URI: http://wordpress.org/ | |
Description: Test Blog | |
Version: 1.6 | |
Author: artesvisuales | |
Author URI: http://artesvisuales.com | |
Tags: chuleta, cheat, referencia | |
*/ |
This file contains hidden or 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 timer_stop(1);?> |
This file contains hidden or 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 bloginfo('name'); ?> |
This file contains hidden or 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 bloginfo('wpurl'); ?> |
This file contains hidden or 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 the_search_query();?> |
This file contains hidden or 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 bloginfo('version'); ?> |
This file contains hidden or 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
is_category() |
This file contains hidden or 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
is_page() |
This file contains hidden or 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
is_single() |
This file contains hidden or 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
is_home() |
This file contains hidden or 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
is_front_page() |
This file contains hidden or 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_options SET option_value = REPLACE ( option_value, 'dominioantiguo.com', 'dominionuevo.com' ); | |
UPDATE wp_posts SET guid = REPLACE ( guid, 'dominioantiguo.com', 'dominionuevo.com' ); | |
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'dominioantiguo.com', 'dominionuevo.com' ); | |
UPDATE wp_postmeta SET meta_value = REPLACE ( meta_value, 'dominioantiguo.com', 'dominionuevo.com' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment