I have a website with “Mikado Newsflash” theme and a custom child theme. I can add functions on child theme and that, but if I modify single.php I get no results. Even if I delete the code on main theme it still works. Is it being called somewhere else? I’ve modified core templates such in framework/modules/blog/templates/singles and no result. Any clue on how to override single.php ?
This is the single.php theme file:
<?php get_header(); newsflash_mikado_get_title(); get_template_part( 'slider' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); //Get blog single type and load proper helper newsflash_mikado_include_blog_helper_functions( 'singles', 'standard' ); //Action added for applying module specific filters that couldn't be applied on init do_action( 'newsflash_mikado_blog_single_loaded' ); //Get classes for holder and holder inner $mkdf_holder_params = newsflash_mikado_get_holder_params_blog(); ?> <div class="<?php echo esc_attr( $mkdf_holder_params['holder'] ); ?>"> <?php do_action( 'newsflash_mikado_after_container_open' ); ?> <div class="<?php echo esc_attr( $mkdf_holder_params['inner'] ); ?>"> <?php newsflash_mikado_get_blog_single( 'standard' ); ?> </div> <?php do_action( 'newsflash_mikado_before_container_close' ); ?> </div> <?php endwhile; endif; get_footer(); ?>
Advertisement
Answer
Most of the times, when an edit on a template file doesn’t change anything is because you are changing the wrong file.
Add this code to your theme’s functions.php file:
functions.php
function cagb_which_template_is_loaded() { if ( is_super_admin() ) { $categories = get_the_category(); //$category_id = $categories[0]->cat_ID; echo '<div style="margin-top:25px;" id="my-debug">'; global $template; print_r( $template ); echo ' | ' . get_the_ID(); echo ' | ' . $categories; echo "</div>"; } } add_action( 'wp_footer' , 'cagb_which_template_is_loaded');
When logged in, this addon will add extra information at the bottom of the page (for debug), when you load the homepage (or any other page) it will show something like this: /www/public_html/wp-content/themes/mikado-newsflash/homepage.php
This way you will know which file of your template is loaded, and you now can edit it.