Skip to content

Instantly share code, notes, and snippets.

View jmarreros's full-sized avatar
🏠
Working from home

Jhon Marreros Guzman jmarreros

🏠
Working from home
View GitHub Profile
@jmarreros
jmarreros / Ejm1-centrar-logo-menu.css
Created November 18, 2016 12:01
Este código ha sido realizado en base al theme de ejemplo Genesis
@media (min-width: 1024px){
.genesis-nav-menu{
text-align: center;
}
.genesis-nav-menu #menu-item-1719{
margin-right: 290px;
}
@jmarreros
jmarreros / Ejm2-centrar-logo-menu.css
Created November 18, 2016 12:03
En este segundo ejemplo se ha usado el theme Responsive como base
@media (min-width: 980px){
header div.col, header nav{
width: 100%;
}
header .menu-short-container{
text-align: center;
}
@jmarreros
jmarreros / maintenance.php
Last active January 2, 2017 16:09
Pantalla Mantenimiento WordPress con SVG incluído
<?php
header( $_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable', true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 600' );
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
@jmarreros
jmarreros / Lista_subcategorias.php
Last active February 27, 2017 15:40
Lista Subcategorías WordPress
<?php
// $list_subcat = get_terms( ['taxonomy' => 'category', 'hide_empty' => false, 'parent' => $cat] );
// $list_subcat = get_categories( ['hide_empty' => false, 'parent' => $cat] );
$list_subcat = array();
if ( !empty($cat) ) $list_subcat = get_categories( ['hide_empty' => false, 'parent' => $cat] );
if ( count($list_subcat)):
echo "<div class='subcat'>";
@jmarreros
jmarreros / Filtro_descripcion_categoria.php
Last active February 27, 2017 15:40
Para colocar código html en la descripción de categoría
<?php
// Unfilter Description
foreach ( array( 'pre_term_description' ) as $filter ) {
remove_filter( $filter, 'wp_filter_kses' );
}
foreach ( array( 'term_description' ) as $filter ) {
remove_filter( $filter, 'wp_kses_data' );
}
@jmarreros
jmarreros / api-woocommerce.php
Last active March 28, 2017 23:20
Conexión y Validación de errores para la REST API Woocommerce
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
try {
$woocommerce = new Client(
@jmarreros
jmarreros / muestra-pagina-estatica.php
Last active June 20, 2017 21:23
Código que muestra una página estática
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ( $paged == 1 && is_home() ) {
$idPage = 2;
$page = get_post( $idPage );
$title = $page->post_title;
@jmarreros
jmarreros / install.php
Last active July 4, 2017 21:07
Archivo para generar un Quickstart en WordPress, depende del archivo srdb.class.php
<?php
require_once( realpath( dirname( __FILE__ ) ) . '/srdb.class.php' );
if (array_key_exists("step",$_REQUEST) && $_REQUEST["step"] == 2){
add_action("shutdown", "dcms_install_data");
}
function dcms_install_data() {
global $wpdb, $wp_rewrite;
@jmarreros
jmarreros / EntradasRecientes.php
Last active August 8, 2017 13:31
Shortcut WordPress para mostrar las entradas recientes.
<?php
add_action( 'init', 'dcms_agregar_shortcode' );
function dcms_agregar_shortcode(){
add_shortcode('EntradasRecientes', 'dcms_entradasrecientes');
}
function dcms_entradasrecientes( $atts , $content ){
@jmarreros
jmarreros / comments.php
Last active February 21, 2018 05:53
Modificar el formulario de comentarios de WordPress
<?php
//Filtro para modificar la estructura
//de los campos del formulario de comentarios
add_filter( 'comment_form_defaults', 'dcms_modify_fields_form' );
function dcms_modify_fields_form( $args ){
$commenter = wp_get_current_commenter();