Updated Pro: wp-single.php (framework/views/icon/wp-single.php)

Hi there,

— Tldr; you guys are ace - I’m getting better at editing your theme but need help! go to Q.

I’ve recently come across a useful subject on your forums that has been the cause of many-a-headache in the past!

While PRO and X allow you to create beautiful and dynamic websites, they are incredibly lacking in the way of customising blog page styles.

As I am not a coder/developer by trade and slowly learn these things as I build a team around me, I’ve only just stumbled across the ability to actually edit the blog post style and even add global block shortcodes to make the pages even more kick-a**. (Though I’m kicking myself that it took me 2 years to even get round to this)

— Q: I’ve updated the wp-single.php (framework/views/icon/wp-single.php) file in the parent theme. This is great, it’s functioning exactly as I want it to. However, in order to add this to the child theme, do I need to replicate the same wp-single.php file inside the same folder structure as the stack above?

Or can I simply add a new wp-single.php to the child theme folder and have it automatically override any of the stack wp-single.php files?

Sorry if that’s poorly phrased, not a tech myself so just figuring this out was a eureka for me.

Hello Dynasty,

Thanks for writing in!

Once you have your child theme active and ready, please follow these steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/ICON/WP-SINGLE.PHP
// -----------------------------------------------------------------------------
// Single post output for Icon.
// =============================================================================

$fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );

get_header();

?>

  <div class="x-main full" role="main">

    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( 'icon', 'content', get_post_format() ); ?>
      <?php x_get_view( 'global', '_comments-template' ); ?>
    <?php endwhile; ?>

  </div>

  <?php if ( $fullwidth != 'on' ) : ?>
    <?php get_sidebar(); ?>
  <?php endif; ?>
<?php get_footer(); ?>

Do not forget to add your customizations.

3] Save the file named as wp-single.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/views/icon/

This is the correct way of overriding the template files of X or Pro theme. You need to replicate the file, save it using the same filename and then create a folder path in the child theme.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.