revistataller9
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Full width postsAs it turns out, the way to achieve this kind of post (I’m talking about regular posts here, not a Custom Post), was to add this piece of code to the functions.php file on my child theme:
add_action('template_include', 'load_single_template'); function load_single_template($template) { $new_template = ''; // single post template if( is_single() ) { global $post; // 'cat-1' and 'cat-2' are category slugs if( has_term('cat-1', 'category', $post) ) { // use template file single-template-cat-1.php $new_template = locate_template(array('single-template-cat-1.php' )); } if( has_term('cat-2', 'category', $post) ) { // use template file single-template-cat-2.php $new_template = locate_template(array('single-template-cat-2.php' )); } } return ('' != $new_template) ? $new_template : $template; }Forum: Themes and Templates
In reply to: [Gateway] Full width postsHey Christi! Great news! As it turns out, the way to achieve this kind of post (I’m talking about regular posts here, not a Custom Post), was to add this piece of code to the functions.php file on my child theme:
add_action('template_include', 'load_single_template'); function load_single_template($template) { $new_template = ''; // single post template if( is_single() ) { global $post; // 'cat-1' and 'cat-2' are category slugs if( has_term('cat-1', 'category', $post) ) { // use template file single-template-cat-1.php $new_template = locate_template(array('single-template-cat-1.php' )); } if( has_term('cat-2', 'category', $post) ) { // use template file single-template-cat-2.php $new_template = locate_template(array('single-template-cat-2.php' )); } } return ('' != $new_template) ? $new_template : $template; }Forum: Themes and Templates
In reply to: [Theme: Gateway] Help with custom post typesAs it turns out, the way to achieve this kind of post (I’m talking about regular posts here, not a Custom Post), was to add this piece of code to the functions.php file on my child theme:
add_action('template_include', 'load_single_template'); function load_single_template($template) { $new_template = ''; // single post template if( is_single() ) { global $post; // 'cat-1' and 'cat-2' are category slugs if( has_term('cat-1', 'category', $post) ) { // use template file single-template-cat-1.php $new_template = locate_template(array('single-template-cat-1.php' )); } if( has_term('cat-2', 'category', $post) ) { // use template file single-template-cat-2.php $new_template = locate_template(array('single-template-cat-2.php' )); } } return ('' != $new_template) ? $new_template : $template; }Forum: Themes and Templates
In reply to: [Gateway] Full width postsI finally managed to solve this! It turns out it could be done by creating a custom post type. I simply copied the single.php file, and renamed it single-viernes.php (viernes is my custom post type name), then applied what you told me earlier and the magic happened!
Thanks a lot for your help Christi! π
Edit: I just noticed my custom posts don’t appear in my home page along with the other posts. How can I correct this?
Forum: Themes and Templates
In reply to: [Gateway] Full width postsHey Christi! Any news on the template issue?
I dived further into it and tried new names to the file but to no avail.I’m thinking maybe the theme sets the posts to be “blog posts” so, according to the hierarchy map, that would derive into single-post.php, then single.php, etc. bypassing the single-{post type}.php branch.
Maybe I’ve enabled the image type posts in a wrong way? From what it says here: http://codex.wordpress.org/Post_Types#Custom_Post_Types, the Custom posts should be enabled in a different way than I did. I simply added this piece of code to my child’s theme functions.php filefunction childtheme_formats(){ add_theme_support( 'post-formats', array( 'image') );Have you found anything else?
Please let me know!
Thanks!Forum: Themes and Templates
In reply to: [Gateway] Full width postsStill nothing π
Also tried page-{slug}.php and attachment.php
Is possible for the theme to override the hierarchy?Forum: Themes and Templates
In reply to: [Gateway] Full width postsI named the file single-image.php as you suggested but, from looking at the template hierarchy chart, shouldn’t the file be named {mimetype}.php? or maybe, given all my image posts will be in the same category, is better if I rename the file category-{category id}.php?
I’m trying those options out and will let you know what happensThank you!
Forum: Themes and Templates
In reply to: [Gateway] Full width postsHi Christi! Thanks for the answer!
Unfortunately it’s still not working. The new code looks like this:<?php /** * The template for displaying all image posts. * */ get_header(); ?> <div class="row"> <div id="primary" class="content-area"> <div class="large-12 columns"> <main id="main" class="site-main" role="main"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'template-parts/content', 'single' ); ?> <?php gateway_post_nav(); ?> <hr> <?php // If comments are open or we have at least one comment, load up the comment template if ( comments_open() || get_comments_number() ) : comments_template(); endif; ?> <?php endwhile; // end of the loop. ?> </main><!-- #main --> </div><!-- .large-12 --> </div><!-- #primary --> </div><!-- .row --> <?php get_footer(); ?>Maybe I’ve messed up somewhere?
Forum: Themes and Templates
In reply to: Full width postsIΒ΄m the Jon Snow of coding