Skip to content

Instantly share code, notes, and snippets.

View gydoar's full-sized avatar
🕶️
Coding

Andrés Vega gydoar

🕶️
Coding
View GitHub Profile
@gydoar
gydoar / background-internal-div.txt
Last active March 27, 2023 20:53
Background dependent on inner div.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.0.0/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<style>
<?php
/**
* Theme support Blocks
* @link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/
*/
function andres_gutenberg_default_colors()
{
@gydoar
gydoar / index.php
Created July 26, 2017 23:45
Shortcode
<?php
// creamos un shortcode llamado [flx-shortcode] para llamarlo donde deseemos
add_shortcode('flx-shortcode', 'flx_funcion');
@gydoar
gydoar / index.php
Created July 26, 2017 23:43
Función para el plugin
<?php
// Creamos la función para mostrarlo desde el frontend
function flx_funcion($type='thum-flx') {
$args = array(
'post_type' => 'flexslider',
'posts_per_page' => 5
);
$result = '<div class="flexslider">';
$result .= '<ul class="slides">';
@gydoar
gydoar / index.php
Created July 26, 2017 23:42
Estructura de flexslider
<?php
<div class="flexslider">
<ul class="slides">
<li>
<img src="slide1.jpg" />
</li>
<li>
<img src="slide2.jpg" />
</li>
<li>
@gydoar
gydoar / index.php
Created July 26, 2017 23:39
Thumbnails
<?php
add_image_size('thum-flx', 600, 280, true); // declaramos el nombre del thumbnail 'thum-flx' y su tamaño
add_theme_support( 'post-thumbnails' ); // agregamos soporte para que pueda funcionar
<?php
// Registrando estilos
function flx_registrar_estilos() {
// registrar
wp_register_style('flx_styles', plugins_url('css/flexslider.css', __FILE__));
// colocar
wp_enqueue_style('flx_styles');
}
// inicializamos con la función de flexslider()
jQuery(document).ready(function($) {
$('.flexslider').flexslider({
animation: "slide"
});
});
<!-- Place somewhere in the <head> of your document -->
<link rel="stylesheet" href="flexslider.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="jquery.flexslider.js"></script>
@gydoar
gydoar / index.php
Created July 26, 2017 19:52
Registrando post type plugin
<?php
function post_type_flexslider() {
register_post_type( 'flexslider',
array( 'labels' => array(
'name' => __( 'Flexslider', 'andres-dev' ),
'singular_name' => __( 'Flexslider', 'andres-dev' ),
'all_items' => __( 'Todos los sliders', 'andres-dev' ),
'add_new' => __( 'Agregar nuevo', 'andres-dev' ),