Jump to content
Sign in to follow this  
danbowyer

ecoPro: Custom template, how to show feature and boxes.

Recommended Posts

danbowyer

Sorry... more questions. :) I am using EcoPro. I want to add 5 blog posts underneath the welcome/introduction of the site (http://www.strictlysocial.co). Normally, I copy the template and simply add the php snippet within that generates the blog. When I copy the template page-feature-page.php and rename the file to home.php, and rename the template to "home", I completely lose both the feature and the boxes I created. I am assuming in order for them to show, the code is looking for the specific template names. How can I make the boxes and feature page to show on a custom template?

Share this post


Link to post
Share on other sites
cmunns

Can we see what that template looks like? It sounds like you need to add the conditional for your new page to the _template.php file Let me know if you need help on adding that page to the code

Share this post


Link to post
Share on other sites
danbowyer

Great, thanks very much. I added my template to the conditional and now the feature and boxes are showing. Now, I'm trying to add my latest 5 blog posts using this code:

<div id="maincontent">
	<h1>News & Blog </h1>
	
			<?php
			 $lastposts = get_posts('numberposts=5');
			 foreach($lastposts as $post) :
				setup_postdata($post);
			 ?>
	
			 <div class="postItem">
				 <h2>"><?php the_title(); ?></h2>
					<div class="meta">
											<?php the_time('M j, Y') ?> ? ? //? ?  by <span class="author"><?php the_author_link(); ?></span> ? ? //? ?   <?php the_category(', ') ?>  ? //?   <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?>
					</div>
	
				 <?php the_content(); ?>
	
			  </div>
	
			 <?php endforeach; ?>
	
		<h4>Want to know more?</h4>
	
	</div><!-- #home-blog -->
	[/code]

	
	The problem is, if I add it to the bottom of my home.php which has only the template code in:
	
[code]<?php if(VPRO) { /* Template Name: Home */ // Get Control Template get_template_part('_template'); } ?>

The blog gets added to the footer (which I kind of expected). I'm not sure how to edit the templates though to make the blog show up right underneath the page content which is my introduction/welcome message (that I wrote using the Wordpress CMS). I would be tempted to use the usual Wordpress page.php calls, but I'm assuming I'd lose the feature and boxes then.

Share this post


Link to post
Share on other sites
Andrew

Well all you need to do to 'show' those partial templates, is include them via PHP e.g.. `get_template_part('pro/template_feature');` but you'll also need to make sure you include the JS for the feature slider/boxes in the header.

Share this post


Link to post
Share on other sites
danbowyer

Sorry, could you explain a bit more. Not that great with PHP, don't quite understand what I'd have to do. Thanks

Share this post


Link to post
Share on other sites
cmunns

okay first would be to add the name of your new page template to the conditional code here in the header to initialize the js: ` <?php if((is_page_template('page-feature.php') || is_page_template('page-feature-page.php') || is_page_template('page-feature-blog.php') || is_page_template('page-feature-fullwidth.php') || (is_home() && pagelines('featureblog'))) && VPRO) get_template_part ('core/inits/init_feature');?> ` You could even add it to the front like this `<?php if((is_page_template('page-custom.php') || is_page_template('page-feature.php') || is_page_template('page-feature-page.php')...` where page-custom is the name of your new custom template `

Share this post


Link to post
Share on other sites
danbowyer

Great, so got the template working now. Just need to add 5 latest blog posts to the home page. Tried to put the snippet in the home.php template, but it adds the blog to the footer. How can I make the blog show up underneath the "Welcome" text.

Share this post


Link to post
Share on other sites
cmunns

instead of adding the code to the home.php file add it to the _template.php file underneath the call to this line: `<?php get_template_part ('_theloop'); ?>` and also wrap it in this `<?php if(is_front_page()):?>.......<?php endif;?>` so it doesn't show on every page.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×