Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

Creating a page of posts/PHP not working in custom main template?


  #1  
Old Jun 24, 2013, 05:29 PM
agent314
 
4 posts · Jun 2013
I have recently installed the Montezuma theme and love the look and feel of it.

I am trying to create a page template that will list posts of a given category/multiple categories in alpha order by post title, but every time I create a custom template and assign it to my page, it seems to incorrectly parse out

What I have in my theme:

Code:
<?php get_header(); ?>

<div id="main" class="row">
	
	<div id="content" class="col8">
		
		<div id="post-<?php the_ID(); ?>" <?php post_class('cf'); ?>>

			<h1>
				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?></a>
				<?php bfa_comments_number(); ?>
			</h1>
			
			<div class="post-bodycopy cf">
				<?php the_content(); ?>
<?php
// The Query
query_posts( array( 
  'category_name' => 'food-drink', 
  'posts_per_page' => -1 ) );
?>

    <?php
// The Loop
while ( have_posts() ) : the_post();
	echo '<h1>';
	the_title();
	echo '</h1>';
	the_excerpt();
	the_date();
	echo 'Categories: ';
	the_category(', ');
	echo '</p>';
	endwhile; ?>

	  <?php

	  // Reset Query
	  wp_reset_query();

	  ?>
             <?php wp_link_pages( array( 
					'before' => __( '<p class="post-pagination">Pages:', 'montezuma' ), 
					'after' => '</p>'
				) ); ?>  
              
             
			</div>

			<?php edit_post_link( __( 'Edit', 'montezuma' ) ); ?>

		</div>
		
		<?php comments_template( '', true ); ?>
		
	</div>
	
	<div id="widgetarea-one" class="col4">
		<?php dynamic_sidebar( 'Widget Area ONE' ); ?>
	</div>
		
</div>

<?php get_footer(); ?>
And this is what appears, formatted with the style of the main body text of my page:


Code:
Content goes here.

'food-drink', 'posts_per_page' => -1 ) ); ?> '; the_title(); echo ''; the_excerpt(); the_date(); echo 'Categories: '; the_category(', '); echo '
'; endwhile; ?>
I've run the PHP through a parser and removed all errors it reported, but it still doesn't seem to work as expected.

Am I doing something wrong? Is the Montezuma theme stripping out certain PHP code and rendering the loop inert? Do I need to change a setting or adjust the code somewhere?

I am a complete newbie to PHP so it could be something very obvious and I just don't have sophisticated enough understanding to recognize it, but if someone can point out my error and/or direct me to where I can learn more, that would be immensely helpful
  #2  
Old Jun 24, 2013, 07:45 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Is this a physical or virtual template?
  #3  
Old Jun 24, 2013, 07:57 PM
agent314
 
4 posts · Jun 2013
I believe it is a virtual template - I created it using the Main Templates option within the Montezuma theme backend.
  #4  
Old Jun 24, 2013, 08:34 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
if you read the onscreen documentation you wll notict that there is limitd PHP you can put in a template. There is even a tab in the upper right that will list all the php you can use.
  #5  
Old Jun 24, 2013, 11:21 PM
agent314
 
4 posts · Jun 2013
Okay, thank you for clearing that up - I read that there was limited PHP allowed and scoped out the list of functions, but I didn't realize it was limited to ONLY those functions and their args.

I assume that is only for the virtual templates? i.e. if I bring it in as a physical template, I can still use the various bits of code I've found in the Codex to accomplish what I've been trying?
  #6  
Old Jun 25, 2013, 01:29 AM
jerryc
 
367 posts · Oct 2012
Florida
This post might help. A sidebar can go in the content section of a template, and you can use any php in the sidebar with this technique. You may need to adjust the CSS so nobody notices that you've used a sidebar. Juggledad also found a different plugin that works right in the text widget.
  #7  
Old Jun 25, 2013, 01:38 AM
agent314
 
4 posts · Jun 2013
Excellent - I will take a look at those tomorrow. Thanks juggledad+Jerry

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Creating custom template for page... wskdigital Atahualpa 3 Wordpress theme 2 Apr 11, 2013 07:19 PM
[SOLVED] custom main template for home page jerryc Montezuma Theme 4 Oct 6, 2012 10:42 AM
[SOLVED] creating posts from the main site janey73 Atahualpa 3 Wordpress theme 2 Jun 24, 2009 05:00 PM
Creating custom post template paulae Atahualpa 3 Wordpress theme 3 Mar 18, 2009 11:36 AM


All times are GMT -6. The time now is 04:56 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.