Tagged: template
- This topic has 10 replies, 2 voices, and was last updated 10 years, 11 months ago by Sakin.
-
AuthorPosts
-
December 27, 2013 at 4:56 pm #18654fastfun.jpMember
Hi,
I wanted a custom template or means to customise the Home page. The Home page is set up to be a static page. I have set it to use Right Sidebar, I copied the content-sidebar.php file to my theme but it does not override it. You seem to be using a non standard means to templating here? What is your recommended method to do this for the Catch Mustang theme?
Thank you,
Paul.December 28, 2013 at 1:54 am #18669SakinKeymaster@fastfun.jp: Can you let me know what are you trying to accomplish. Then I can send you the code. content-sidebar.php file uses
catchthemes_theloop()
function which you will find it in catchthemes_functions.php. You can copy that function to your child theme functions.php file and edit it there.December 28, 2013 at 1:54 pm #18682fastfun.jpMemberThat’s great Sakin.
I wanted to have the slider on the homepage only, full width. Under that I then want a template with a sidebar on the right. I wanted a grid of the featured services displayed by thumbnail. Similar to the 4 car images in the mustang demo under the slider but with 3 columns x N rows of images and a sidebar on the right.
If you have a recommendation for achieving this to benefit from inheritance from the parent / updates in the future, please let me know.
Thanks again!
December 29, 2013 at 12:25 am #18696SakinKeymaster@fastfun.jp:
1. For Slider, you can just go to “Appearance => Theme Options => Featured Slider”. Then in “Enable Slider”, you can select “Homepage / Frontpage”. This will make your slider to appear only on homepage.2. To you can disable all the Homepage Sidebar from “Appearance => Theme Options => Homepage Options => Homepage Sidebar Options”.
3. Then you can add static front page with the content you want. Go to “Appearance => Theme Options => Homepage Options => Homepage/Frontpage Settings”. Then select “Enable Latest Posts or Page” and then add static page from “Settings => Readings => Front page displays” and select the page A static page (select below).
3. Then you can create child theme and then create function.php and add your custom function there and hook in with action hook.
December 29, 2013 at 5:34 pm #18717fastfun.jpMemberExcellent, the last point was my missing piece, this seems like a standard WordPress theme override which is great.
Thanks again.
January 3, 2014 at 8:04 am #18819fastfun.jpMemberHi Sakin,
I’d like to reuse and possibly override the archive-services.php template on the homepage but including a right sidebar this time. What is the best way to go about this?
If I also intend on overriding the archive-services.php on the /services page does this change anything? i.e. – is there a better method to get around both scenarios above?
Thank you,
Paul.January 4, 2014 at 9:33 am #18837SakinKeymaster@fastfun.jp: archive-services.php can be use to replace your service archive page but cannot be used for homepage. But the best way to change the homepage is through functions.php or index.php file.
January 4, 2014 at 1:56 pm #18853fastfun.jpMemberThat’s great Sakin. However I tried to override the content-sidebar.php and this does not seem to override when placed in my theme. How do I get content-sidebar.php to override?
After the do_action( ‘catchthemes_before_loop_content’ ); in content-sidebar.php I added a check for is_front_page to display the services.
<?php if(is_front_page()): ?> <div id="content" class="clearfix"> <div class="service clearfix"> <?php global $post; $i = 1; if( have_posts() ): while ( have_posts() ) : the_post(); if ($i % 2 == 1) { $class = "smart-even"; } else { $class = "smart-odd"; } $output = '<dl class="service-item '.$class.'">'; if( has_post_thumbnail() ) { $output .= '<dt class="service-icon">'; $output .= '<a href="'.get_permalink().'" title="'.the_title_attribute('echo=0').'">'.get_the_post_thumbnail( $post->ID, 'gallery', array( 'title' => get_the_title(), 'alt' => get_the_title() ) ).'</a></dt>'; } $output .= '<dd><h3 class="entry-title"><a href="'.get_permalink().'" title="'.the_title_attribute('echo=0').'">'.get_the_title().'</a></h3>'; $output .= '<p>'.get_the_excerpt().'</p></dd>'; $output .= '</dl>'; echo $output; if( ($i%4) == 0 ) { echo '<div style="clear:both;"></div>'; } $i++; endwhile; else: ?> <h1 class="entry-title"><?php _e( 'No Posts for this Custom Post Type', 'catchthemes' ); ?></h1> <?php endif; ?> </div><!-- .service --> <div class="clearfix"></div> <?php do_action( 'catchthemes_before_nav' ); ?> <?php if( function_exists( 'catchthemes_next_previous' ) ) { catchthemes_next_previous(); } ?> <?php do_action( 'catchthemes_after_nav' ); ?> </div><!-- #content -->
I see
global $post;
How do I populate $post with services posts or whatever it contains contains when used in archive-services.php? I’m not sure where $post is populated.I’m just looking for the most maintainable way to do things inline with the parent theme. I find wordpress very non-standardised for doing this, is this true? I’m trying to see if there is a way or is every child wordpress theme not a real child, just a work around hack for anything custom…
Thanks Sakin.
January 4, 2014 at 3:18 pm #18860SakinKeymaster@fastfun.jp: I don’t get it what are you trying to do it. This is not the right way to do it. Please use hire a customizer as this falls under customization not under basic support.
January 4, 2014 at 6:55 pm #18872fastfun.jpMemberNo problem, this is what I expected. Really find WordPress lacking in this area, it has a very non-standardised way of customising, inheriting and developing in general. You’ve done a great job with the theme however, it looks great and is functioning well.
I also understand this is not basic support, so appreciate your patience. I will be able to hack it to do what I like, I was just enquiring in terms of best wordpress practices or methods to do this with your theme, link references or whatnot.
No problem, thanks again.
January 5, 2014 at 9:57 pm #18903 -
AuthorPosts
- The topic ‘Overriding default templates in a child theme’ is closed to new replies.