Tagged: x
-
AuthorPosts
-
June 3, 2016 at 6:54 am #1024038
Mika AParticipantHi
I’m making a custom page template and I’d like to just confirm that have I made this correctly.
I have the X Child theme active and I copied one of the Renew’s template-php-files to the root of my child theme’s folder and named and changed the contents to my liking.In the template I have a php code to generate the contents of that page automatically so I removed this section of the original template because I don’t need any content to be shown from the editor:
<?php while ( have_posts() ) : the_post(); ?> <?php x_get_view( 'renew', 'content', 'page' ); ?> <?php x_get_view( 'global', '_comments-template' ); ?> <?php endwhile; ?>So the whole code of the template is as follows (contains finnish words):
<?php /* --------------------------------------------------------------------------- Template Name: Course information template Description: This template fetches the information of a course from the interface. Version: 1.0 Author: Mika Autio Author URI: http://www.valakia.fi ------------------------------------------------------------------------ */ ?> <?php get_header(); ?> <div class="x-container max width offset"> <div class="<?php x_main_content_class(); ?>" role="main"> <?php // Save the name of the site (js-variable) so it can be shown as page name wp_localize_script( 'epky-kurssit', 'sivuston_nimi', get_bloginfo( 'name' ) ); if( $id = absint( $wp_query->query_vars['kurssi'] ) ) { // If the info is already cached, fetch and process if( get_transient( KURSSIESITE_TRANSIENT . $id ) ) { echo prosessoi_kurssiesite( $id ); } // If not cached, create a div, and populate info with ajax else { echo '<div class="kurssilistaus_ajax entry-content" data-operaatio="kurssiesite" id="' . $id . '"><p><img src="' . admin_url('/images/wpspin_light.gif') . '"/> Tietoja haetaan...</p></div>'; } } ?> </div> </div> <?php get_footer(); ?>The actual code works, so I’m not asking about that, but just about the template, that is everything correctly placed in the template and is it ok to remove the original content-part?
And additional question: The code doesn’t change the page name as it should. It works with the twentysixteen-theme, but is there some conflict why it is not working with X?
Thanks,
MikeJune 3, 2016 at 7:09 am #1024050
Mika AParticipantHi again,
actually we got the name-part working. But still would like to know if the overall placement of the code is correct. 🙂
Thanks,
MikeJune 3, 2016 at 10:09 am #1024337
DarshanaModeratorHi there,
Thanks for writing in! Please refer to our guide on customization best practices (https://community.theme.co/kb/customization-best-practices/).
Hope that helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1024038 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
