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 | |
// Mostrar primer imagen de post como la featured image | |
function autoset_featured() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); | |
if (!$already_has_thumb) { | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID, $attachment_id); |
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 | |
/* | |
Template Name: Portfolio | |
Template Post Type: page | |
*/ | |
?> | |
<?php get_header(); ?> | |
<div class="container"> | |
<!-- Page Heading --> | |
<div class="row"> |
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 | |
//========================= Categorias para el Portfolio Custom Post Type ===========================// | |
//Crea un custom taxonomy para los posts | |
function portfolio_categories_taxonomy() { | |
// Añade un taxonomy nuevo, y hazlo jerarquico como categorias | |
//Primero haz las traducciones necesarias para el editor visual | |
$portfolio_cats = 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
<?php | |
function custom_portfolio_type() { | |
// Configura las labels para el CPT (custom post type) | |
$portfolio_labels = array( | |
'name' => _x( 'Portfolios', 'Post Type General Name', 'kevinurielfonseca' ), | |
'singular_name' => _x( 'Portfolio', 'Post Type Singular Name', 'kevinurielfonseca' ), | |
'menu_name' => __( 'Portfolios', 'kevinurielfonseca' ), | |
'parent_item_colon' => __( 'Parent Portfolio', 'kevinurielfonseca' ), | |
'all_items' => __( 'All Portfolios', 'kevinurielfonseca' ), | |
'view_item' => __( 'View Portfolio', 'kevinurielfonseca' ), |
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
<style> | |
.showcase{ | |
background:url(<?php echo get_theme_mod('showcase_image', get_bloginfo('template_url').'/img/showcase.jpg'); ?>) no-repeat center center; | |
} | |
</style> | |
<section class="showcase"> | |
<div class="container"> | |
<h1><?php echo get_theme_mod('showcase_heading', 'Welcome to Kevin Fonseca Wordpress Theme'); ?></h1> | |
</div> | |
</section> |
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 mytheme_customize_register( $wp_customize ) { | |
//Aqui es donde crearemos nuestros add sections, add setting, y add controls. | |
//Primero van los seccion, dentro de ellos van los add setting y despues los add controls. | |
// Si deseas crear otra seccion se deben seguir los mismos pasos nuevqamente. | |
$wp_customize->add_section('showcase', array( | |
'title' => __('yourseccionname', 'yourthemename'), | |
'description' => sprintf(__('Options for youthemename','yourthemename')), | |
'priority' => 130 // aqui puedes controlar el orden en el cual quieras que aparesca. | |
//Nota que no se puede mostrar antes que las secciones que estan por default en Wordpress |
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 mytheme_customize_register( $wp_customize ) { | |
//Aqui es donde crearemos nuestros add sections, add setting, y add controls. | |
//Primero van los seccion, dentro de ellos van los add setting y despues los add controls. | |
// Si deseas crear otra seccion se deben seguir los mismos pasos nuevqamente. | |
$wp_customize->add_section('showcase', array( | |
'title' => __('yourseccionname', 'yourthemename'), | |
'description' => sprintf(__('Options for youthemename','yourthemename')), | |
'priority' => 130 // aqui puedes controlar el orden en el cual quieras que aparesca. | |
//Nota que no se puede mostrar antes que las secciones que estan por default en Wordpress |
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 mytheme_customize_register( $wp_customize ) { | |
//Aqui es donde crearemos nuestros add sections, add setting, y add controls. | |
//Primero van los seccion, dentro de ellos van los add setting y despues los add controls. | |
// Si deseas crear otra seccion se deben seguir los mismos pasos nuevqamente. | |
$wp_customize->add_section('showcase', array( | |
'title' => __('yourseccionname', 'yourthemename'), | |
'description' => sprintf(__('Options for youthemename','yourthemename')), | |
'priority' => 130 // aqui puedes controlar el orden en el cual quieras que aparesca. | |
//Nota que no se puede mostrar antes que las secciones que estan por default en Wordpress |
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 mytheme_customize_register( $wp_customize ) { | |
//Aqui es donde crearemos nuestros add sections, add setting, y add controls. | |
} | |
add_action( 'customize_register', 'mytheme_customize_register' ); | |
?> |