WordPress.org

Support

Support » Themes and Templates » Customizr » Create custom single.php file

Create custom single.php file

  • Hi. I created my website http://www.ifixlv.com with Customizr theme. Now I found out that i have many errors in Google Webmaster tool – structured data – hentry. In order to fix that I need to modify single.php file which my current theme do not have.

    So I have a question, can I create a single.php file for current theme? If yes, how to do it?

    Is there another version of Customizr that already contains the single.php file?

    PLEASE HELP. REALLY NEED TO FIX THIS.

Viewing 15 replies - 1 through 15 (of 32 total)
  • Moderator Matthew

    @kidsguide

    The default single.php looks something like this.

    <?php
    /**
     * The Template for displaying all single posts
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    			<?php
    				// Start the Loop.
    				while ( have_posts() ) : the_post();
    
    					/*
    					 * Include the post format-specific template for the content. If you want to
    					 * use this in a child theme, then include a file called called content-___.php
    					 * (where ___ is the post format) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    
    					// Previous/next post navigation.
    					twentyfourteen_post_nav();
    
    					// If comments are open or we have at least one comment, load up the comment template.
    					if ( comments_open() || get_comments_number() ) {
    						comments_template();
    					}
    				endwhile;
    			?>
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php
    get_sidebar( 'content' );
    get_sidebar();
    get_footer();

    You may want to create a child theme for your current theme and add the single.php to that.

    Thank you for the quick reply. If I include this single.php file to my Customizr theme, will it effect my website look?

    I found this article, how to fix my structured data problem. http://urbanstoic.com/how-to-fix-google-hfeed-or-hcard-warnings
    But I couldn’t find these codexes in Customizr theme:

    <span class=”post_date”><?php the_time(‘j F,Y’); ?></span>
    <span class=”theauthor”><?php the_author_posts_link(); ?></span>

    There is no single.php file and my index.php looks like this:

    <?php
    /**
    * The main template file. Includes the loop.
    *
    *
    * @package Customizr
    * @since Customizr 1.0
    */
    ?>
    <?php do_action( ‘__before_main_wrapper’ ); ##hook of the header with get_header ?>
    <div id=”main-wrapper” class=”<?php echo tc__f( ‘tc_main_wrapper_classes’ , ‘container’ ) ?>”>

    <?php do_action( ‘__before_main_container’ ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)…and whatever you need! ?>

    <div class=”container” role=”main”>
    <div class=”<?php echo tc__f( ‘tc_column_content_wrapper_classes’ , ‘row column-content-wrapper’ ) ?>”>

    <?php do_action( ‘__before_article_container’); ##hook of left sidebar?>

    <div id=”content” class=”<?php echo tc__f( ‘__screen_layout’ , tc__f ( ‘__ID’ ) , ‘class’ ) ?> article-container”>

    <?php do_action (‘__before_loop’);##hooks the header of the list of post : archive, search… ?>

    <?php if ( tc__f(‘__is_no_results’) || is_404() ) : ##no search results or 404 cases ?>

    <article <?php tc__f(‘__article_selectors’) ?>>
    <?php do_action( ‘__loop’ ); ?>
    </article>

    <?php endif; ?>

    <?php if ( have_posts() && !is_404() ) : ?>
    <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
    <?php the_post(); ?>

    <?php do_action (‘__before_article’) ?>
    <article <?php tc__f(‘__article_selectors’) ?>>
    <?php do_action( ‘__loop’ ); ?>
    </article>
    <?php do_action (‘__after_article’) ?>

    <?php endwhile; ?>

    <?php endif; ##end if have posts ?>

    <?php do_action (‘__after_loop’);##hook of the comments and the posts navigation with priorities 10 and 20 ?>

    </div><!–.article-container –>

    <?php do_action( ‘__after_article_container’); ##hook of left sidebar ?>

    </div><!–.row –>
    </div><!– .container role: main –>

    <?php do_action( ‘__after_main_container’ ); ?>

    </div><!–#main-wrapper”–>

    <?php do_action( ‘__after_main_wrapper’ );##hook of the footer with get_get_footer ?>

    ANY IDEA WHERE CAN I FIND THESE CODEX IN CUSTOMIZR THEME?

    Moderator Matthew

    @kidsguide

    I am don’t know the theme so well but it should have a single.php in it.

    That is my problem. If it would have a single.php I could modify it. But it does not. Do you know where else I can try to find the codex I need to modify?

    Here is the list of files from my current theme:

    Templates

    Comments
    (comments.php)
    Custom Page Example Page Template
    (custom-page.php)
    Footer
    (footer.php)
    Theme Functions
    (functions.php)
    Header
    (header.php)
    class-fire-init.php
    class-fire-resources.php
    class-fire-utils.php
    class-fire-widgets.php
    Main Index Template
    (inc/index.php)
    init.php
    Main Index Template
    (index.php)
    sidebar-left.php
    sidebar-right.php

    Styles

    Stylesheet
    (style.css)

    Moderator Matthew

    @kidsguide

    The index.php or the custom-page.php maybe.

    Look, the single.php template you sent me also does not have these codex:

    <span class=”post_date”><?php the_time(‘j F,Y’); ?></span>
    <span class=”theauthor”><?php the_author_posts_link(); ?></span>

    What should I do?

    I checked both index.php (also I sent it to you earlier) and the custom-page.php there is no these codex

    <span class=”post_date”><?php the_time(‘j F,Y’); ?></span>
    <span class=”theauthor”><?php the_author_posts_link(); ?></span>

    Moderator Matthew

    @kidsguide

    The theme author would be the best person to answer this.

    How can I reach the theme author? I went to the theme website but it gives me error when trying to connect to support forum.

    Is there anyone here, who can help me?

    Moderator Matthew

    @kidsguide

    The theme author should respond to this support topic soon (that is if he is a good author).

    You also may find something one his website.

    Ok. Thank you Matthew. Ill wait for the author respond

    I’m not the author, but I will try to help.

    First off, when you post code, post it in backticks (or use the “code” button). Otherwise you risk breaking this site.

    Now I found out that i have many errors in Google Webmaster tool – structured data – hentry.

    What precisely are the errors?

    In order to fix that I need to modify single.php file which my current theme do not have.

    Why do you think this is the solution?

    So I have a question, can I create a single.php file for current theme?

    It’s not likely to help, no.

    Is there another version of Customizr that already contains the single.php file?

    No.

    We need to know what errors you have in order to resolve them.

    Ok. Thank you for agreeing to help.

    1. I have these errors in Google Webmaster – Structured data – hentry: missing author, missing update

    2. I found this article, how to fix my structured data problem. http://urbanstoic.com/how-to-fix-google-hfeed-or-hcard-warnings

    In this article the solution is to modify author and update codes in the single.php file. My problem is that the Customizr theme does not have that file.

    Is there another solution to remove these errors in Webmaster?

    Moderator Matthew

    @kidsguide

    To fix it, just make a single.php. Have you tried the single.php?

    ifixlv: could you post the full errors from Google? I’m pretty sure that article is not your solution. We’ve covered this before here, but I need the precise errors to look it up.

Viewing 15 replies - 1 through 15 (of 32 total)
  • The topic ‘Create custom single.php file’ is closed to new replies.
Skip to toolbar