-
-
Save DavidPeralvarez/02061d7ab155853ad15cd5d4997332da to your computer and use it in GitHub Desktop.
Cómo mezclar distintos tipos de contenido en la plantilla de inicio
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 part for displaying posts | |
* | |
* @link https://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package WordPress | |
* @subpackage Twenty_Seventeen | |
* @since 1.0 | |
* @version 1.2 | |
*/ | |
?> | |
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<?php | |
if ( is_sticky() && is_home() ) : | |
echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) ); | |
endif; | |
?> | |
<header class="entry-header"> | |
<?php | |
if( 'scv_comic_review' === get_post_type() ){ | |
echo '<div class="review-tag">'.__( 'Reseña', 'tschild' ).'</div>'; | |
} | |
if ( 'post' === get_post_type() ) { | |
echo '<div class="entry-meta">'; | |
if ( is_single() ) { | |
twentyseventeen_posted_on(); | |
} else { | |
echo twentyseventeen_time_link(); | |
twentyseventeen_edit_link(); | |
}; | |
echo '</div><!-- .entry-meta -->'; | |
}; | |
if ( is_single() ) { | |
the_title( '<h1 class="entry-title">', '</h1>' ); | |
} elseif ( is_front_page() && is_home() ) { | |
the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); | |
} else { | |
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); | |
} | |
?> | |
</header><!-- .entry-header --> | |
<?php if ( '' !== get_the_post_thumbnail() && ! is_single() ) : ?> | |
<div class="post-thumbnail"> | |
<a href="<?php the_permalink(); ?>"> | |
<?php the_post_thumbnail( 'twentyseventeen-featured-image' ); ?> | |
</a> | |
</div><!-- .post-thumbnail --> | |
<?php endif; ?> | |
<div class="entry-content"> | |
<?php | |
/* translators: %s: Name of current post */ | |
the_content( sprintf( | |
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentyseventeen' ), | |
get_the_title() | |
) ); | |
wp_link_pages( array( | |
'before' => '<div class="page-links">' . __( 'Pages:', 'twentyseventeen' ), | |
'after' => '</div>', | |
'link_before' => '<span class="page-number">', | |
'link_after' => '</span>', | |
) ); | |
?> | |
</div><!-- .entry-content --> | |
<?php | |
if ( is_single() ) { | |
twentyseventeen_entry_footer(); | |
} | |
?> | |
</article><!-- #post-## --> |
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 | |
/** | |
* Enqueue styles | |
*/ | |
function scv_enqueue_styles(){ | |
// Parent Theme stylesheet | |
wp_enqueue_style( 'twentyseventeen-style', get_template_directory_uri().'/style.css' ); | |
// Theme stylesheet | |
wp_enqueue_style( 'twentyseventeen-child-style', get_stylesheet_uri(), array('twentyseventeen-style') ); | |
} | |
add_action( 'wp_enqueue_scripts', 'scv_enqueue_styles' ); | |
/** | |
* Mix CPT at index template | |
*/ | |
function scv_mix_cpt( $query ){ | |
if ( $query->is_home() && $query->is_main_query() && ! is_admin() ) { | |
$query->set( 'post_type', array('post','scv_comic_review') ); | |
} | |
} | |
add_action( 'pre_get_posts', 'scv_mix_cpt' ); |
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
/* | |
Theme Name: Twenty Seventeen Child | |
Theme URI: https://silicodevalley.com | |
Author: David Perálvarez | |
Author URI: https://silicodevalley.com | |
Description: Twenty Seventeen with CPT and CT support | |
Version: 1.0.0 | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
Text Domain: tschild | |
Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready | |
Template: twentyseventeen | |
*/ | |
.post-type-archive-scv_comic_review .entry-taxonomies, | |
.tax-scv_comic_author .entry-taxonomies, | |
.tax-scv_comic_genre .entry-taxonomies, | |
.single-scv_comic_review .entry-taxonomies{ | |
background-color: #eee; | |
padding: 10px 20px; | |
margin-bottom: 30px; | |
} | |
.post-type-archive-scv_comic_review .entry-taxonomies a, | |
.tax-scv_comic_author .entry-taxonomies a, | |
.tax-scv_comic_genre .entry-taxonomies a, | |
.single-scv_comic_review .entry-taxonomies a{ | |
text-decoration: underline; | |
} | |
.review-tag{ | |
background-color: Beige; | |
color: DarkGoldenRod; | |
display: inline-block; | |
padding: 4px 8px; | |
border-radius: 4px; | |
margin-bottom: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment