Skip to content

Instantly share code, notes, and snippets.

View cesjam7's full-sized avatar
🍊
Working from home

César Jefferson Aquino Maximiliano cesjam7

🍊
Working from home
View GitHub Profile
@cesjam7
cesjam7 / archivos_adjuntos_wp.php
Created April 2, 2014 22:12
Traer archivos adjuntos de una página wordpress
<?php
/* Con esta función podremos traer los archivos adjuntos de una página. Solo ponemos este código en la página deseada y nos mostrará los archivos. */
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
@cesjam7
cesjam7 / ayuda_harry.php
Created September 2, 2014 16:20
filtrar por post_type y categoria
<?php query_posts( array('post_type' => 'noticias', 'cat' => 104, 'showposts' => 4) );
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<p><?php the_title(); ?></p>
<?php endwhile;
endif; ?>
<?php
register_post_type( 'noticias', array(
'label' => __( 'noticias', 'anqatv' ),
'description' => __( 'Entradas para las noticias de AnqaTV', 'anqatv' ),
'labels' => array(
'name' => _x( 'Anqa Noticias', 'Post Type General Name', 'anqatv' ),
'singular_name' => _x( 'Noticia', 'Post Type Singular Name', 'anqatv' ),
'menu_name' => __( 'Noticias', 'anqatv' ),
'parent_item_colon' => __( 'De la Noticia:', 'anqatv' ),
'all_items' => __( 'Todas las Noticias', 'anqatv' ),
@cesjam7
cesjam7 / gist:ace4a6584b0eb4c2fd64
Created September 2, 2014 22:15
taxonomia.php
$args = array(
'post_type'=> 'noticias',
'showposts'=> '4',
'tax_query' => array(
array(
'taxonomy' => 'categoria',
'field' => 'slug',
'terms' => 'educacion',
),
),
<?php
// Function add orden data
function insert_orden($idpost, $idauto, $idcliente, $idarrendatario, $contacto_nombre, $contacto_telefono, $contacto_email, $facturar, $ruc, $direccion, $fecha_ingreso, $hora_ingreso, $fecha_diagnostico) {
global $wpdb;
$table = "wp_ordenes";
$wpdb->insert($table, array('idpost'=>$idpost,
'idauto'=>$idauto,
'idcliente'=>$idcliente,
'idarrendatario'=>$idarrendatario,
'contacto_nombre'=>$contacto_nombre,
<div class="panel panel-primary">
<script>
$(document).ready(function() {
var max_fields = 10; //maximum input boxes allowed
var wrapper = $("#datos_extras"); //Fields wrapper
var add_button = $(".agregar_datos"); //Add button ID
<?php $datos = get_post_meta(get_the_id(), "datos_extras", true);
if($datos==null) $datos = 0; ?>
var x = <?php echo $datos ; ?>;
$(add_button).click(function(e){ //on add input button click
@cesjam7
cesjam7 / index.html
Created March 16, 2016 03:09
codigo basico de bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mi pagina con Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<!-- Titulo -->
@cesjam7
cesjam7 / custom.css
Last active March 23, 2016 03:00
pael basico ismem clase 2
.sidebar {
background: black;
color: white;
font-size: 30px;
height: 100%;
}
.sidebar img {
margin: 30px 0;
}
.sidebar i {
@cesjam7
cesjam7 / index.html
Created March 23, 2016 23:40
Clase de grillas
<html>
<head>
<title>Practica de grillas</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-4">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In dolor ex, dictum et velit non, interdum sodales nulla. Suspendisse a ullamcorper est. Vestibulum in iaculis velit. Nam sit amet vestibulum risus. Vestibulum hendrerit egestas ipsum sed imperdiet. Nulla ante sem, sagittis vitae ex sed, commodo aliquet urna. Mauris eu massa libero. Mauris massa metus, elementum quis dignissim eget, egestas a libero. Maecenas viverra ligula sem, quis congue turpis feugiat et. Sed nec magna nisi. Vivamus convallis, est non varius aliquet, est lacus finibus lorem, nec pharetra tortor nulla maximus urna. Phasellus vulputate libero ut urna congue pharetra. Suspendisse dapibus nulla eu tellus eleifend, eget ullamcorper tellus pellentesque.</p>
@cesjam7
cesjam7 / yankenpo.html
Created March 30, 2016 02:55
Jugar yankenpo! con la maquina
<script>
// Leer http://www.xatakaciencia.com/computacion/alphago-su-victoria-en-el-go-nos-encamina-a-un-nuevo-mundo-de-inteligencia-artifical
function randomIntervalo(numeroInicio, numeroFin) {
var aleatorio = Math.random();
var diferencia = numeroFin - numeroInicio;
var numero = aleatorio * diferencia;
return Math.round(numero) + numeroInicio;