Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] how to create a page template?


  #1  
Old Dec 31, 2009, 05:28 AM
drongo
 
27 posts · Sep 2009
Hi,

I am new to Wordpress and I am using Atahualpa. I try to use WP more like a CMS. So I have a lot of pages. In the documentary of WP it is written that I can use templates for pages to insert posts of a specific category in my pages. The page.php should be the default template. And I just need to create a new something.php for each page which should have a unique template. But there is no page.php in the atahulapa-folder. When I copy one from the default-WP-theme and name it like template1.php, it doesn't show up in the template-dropdown-list. How does Atahualpa handle templates? Does it at all? Or is there any other way to bring complete articles to a page?

Greetings,
Drongo

Last edited by drongo; Jan 1, 2010 at 11:20 AM. Reason: theme of thread altered
  #2  
Old Dec 31, 2009, 05:33 PM
Rashell's Avatar
Rashell
 
67 posts · May 2009
With ATA all the "templates" are created from the same .php files. It won't matter whether you're creating a post, a page, an archive, etc. If you want to create a bunch of pages you just need to go to the Page section of your admin and click "add new" to get another blank content screen for a new page.

With ATA, you only need to create a page templates if you want to have a different page formats or styles from the one you are primarily using. Say for instance if you want to create a blue colored background for all your posts on peas and a green colored background for posts on blueberries... You'd make a "blue" template and a "green" template. And those would appear in the dropdown.

If you don't need pages that look "different" you're all set with ATA. You just need to add a new post or a new page. It's automatic!

Rashell
  #3  
Old Dec 31, 2009, 05:58 PM
lmilesw's Avatar
lmilesw
 
10,174 posts · Jul 2009
Central New York State USA
Do you have an example of what you are trying to accomplish drongo? There is probably an easier way to go than creating page templates.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #4  
Old Jan 1, 2010, 07:11 AM
drongo
 
27 posts · Sep 2009
Hi,

I know how to create different pages. But I dont know how to add articles of the blog to them. I am trying the plugin WP-RSSImport to add a feed of my categories to single pages, but it is not working very good.

For example, I have a page for press-articles about our culture-centre (its a german page):
http://www.kubiz-wallenberg.de/wordpress/?page_id=210
Here are only articles from this category:
http://www.kubiz-wallenberg.de/wordpress/?cat=12

And on the main page only special articles should show up:
http://www.kubiz-wallenberg.de/wordpress/
from this category: http://www.kubiz-wallenberg.de/wordpress/?cat=1

The plug-in is not working good. Normaly it should add the articles with full html (images and stuff), not only the preview.
I thougt this can be accomplished more easily using templates.

Greetings,
Drongo
  #5  
Old Jan 1, 2010, 07:36 AM
lmilesw's Avatar
lmilesw
 
10,174 posts · Jul 2009
Central New York State USA
There are a couple of plugins you might want to try.
Front Page Manager and Opt-In Front Page
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #6  
Old Jan 1, 2010, 07:45 AM
drongo
 
27 posts · Sep 2009
nope, these are only for the front-page. But I want to have at the front page articles of category One, on another page articles of category Two and so on.
  #7  
Old Jan 1, 2010, 08:07 AM
Rashell's Avatar
Rashell
 
67 posts · May 2009
Ahhhh! I think I get it. You're trying to stylize your category pages with more information than what's coming up automatically.

If you need them images attached to your excerpts in thumbnail view. I've been able to add images using "Thumbnails for Excerpts". But that plugin had a conflict with another when I updated so I used "Get the Image".

If you really want to create a new page template you have to grab & combine code from 3 sources in ATA. The...

header.php
index.php
footer.php

You can combine the 3 give them a new template title (change the "LP" in the code below to whatever name you want to give it) and you'll see a new drop down box with that title included.

I created a new template that is exactly the same as the original except the header.php has a dynamic header rather than the original ATA header. Because nothing changed in the footer I left it as the original index.php was set up. From what I understood you'd have to combine the header.php & index.php to form a new template since both have important elements of the code, which makes the page display. I may be wrong...

As I mentioned the code below changes the header of the page giving it a Dynamic Header so if you download that plugin you're good to go. Otherwise you want to change the code between

PHP Code:
     <!-- Header -->
        <td id="header" colspan="<?php echo $bfa_ata['cols']; ?>">
                       <?php show_media_header(); ?>
        </td>
        <!-- / Header -->
Here's the code if it helps...

PHP Code:
<?php
/*
Template Name: LP
*/
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<?php /* if index.php or another page template (copied from index.php) was not used
(i.e. by a plugin such as WPG2), the global $bfa_ata would be empty */
global $bfa_ata; if ($bfa_ata == "") include_once (TEMPLATEPATH '/functions/bfa_get_options.php'); ?>
<?php 
if ( $bfa_ata['css_external'] == "External" ) { ?>
<link rel="stylesheet" href="<?php echo $bfa_ata['get_option_home']; ?>/?bfa_ata_file=css" type="text/css" media="all" />
<?php ?>
<?php 
include (TEMPLATEPATH '/functions/bfa_meta_tags.php'); ?>
<?php     
/* get all options: */ include (TEMPLATEPATH '/functions/bfa_get_options.php');?>
<?php 
if ($bfa_ata['favicon_file'] != "") { ?><link rel="shortcut icon" href="<?php echo $bfa_ata['template_directory']; ?>/images/favicon/<?php echo $bfa_ata['favicon_file']; ?>" /><?php ?>
<?php 
if ( is_single() OR is_page() ) { ?><link rel="canonical" href="<?php the_permalink(); ?>" /><?php ?>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php     wp_enqueue_script'jquery' ); ?>
<?php 
if ( function_exists('wp_list_comments') AND is_singular() ) {     wp_enqueue_script'comment-reply' ); } ?>
<?php wp_head
(); ?>
<?php 
echo ($bfa_ata['html_inserts_header'] != "" apply_filters(widget_text$bfa_ata['html_inserts_header']) : ''); ?>
<?php 
if ($bfa_ata['pngfix_selectors'] != "") { ?>
<!--[if IE 6]>
<script type="text/javascript" src="<?php echo $bfa_ata['template_directory']; ?>/js/DD_roundies.js"></script>
<script type="text/javascript">DD_roundies.addRule('<?php echo $bfa_ata['pngfix_selectors']; ?>');</script>
<![endif]-->

<?php ?>
</head>

<body <?php body_class(); ?><?php echo ($bfa_ata['html_inserts_body_tag'] != "" ' ' apply_filters(widget_text$bfa_ata['html_inserts_body_tag']) : ''); ?>>
<?php echo ($bfa_ata['html_inserts_body_top'] != "" apply_filters(widget_text$bfa_ata['html_inserts_body_top']) : ''); ?>

<div id="wrapper">
<div id="container">
<table id="layout" border="0" cellspacing="0" cellpadding="0">
<colgroup>
<?php if ( $bfa_ata['left_col'] == "on" ) { ?><col class="colone" /><?php ?>
<?php 
if ( $bfa_ata['left_col2'] == "on" ) { ?><col class="colone-inner" /><?php ?>
<col class="coltwo" />
<?php if ( $bfa_ata['right_col2'] == "on" ) { ?><col class="colthree-inner" /><?php ?>
<?php 
if ( $bfa_ata['right_col'] == "on" ) { ?><col class="colthree" /><?php ?>
</colgroup> 


    <tr>

        <!-- Header -->
        <td id="header" colspan="<?php echo $bfa_ata['cols']; ?>">
                       <?php show_media_header(); ?>
        </td>
        <!-- / Header -->

    </tr>

    <!-- Main Body -->    
    <tr id="bodyrow">

        <?php if ( $bfa_ata['left_col'] == "on" ) { ?>
        <!-- Left Sidebar -->
        <td id="left">

            <?php // Widgetize the Left Sidebar 
            
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Sidebar') ) : ?>
        
                    <div class="widget widget_categories"><div class="widget-title">
                    <h3><?php _e('Categories','atahualpa'); ?></h3>
                    </div>
                    <ul><?php wp_list_categories('show_count=1&title_li='); ?></ul>
                    </div>
                    
                    <div class="widget widget_archive"><div class="widget-title">
                    <h3><?php _e('Archives','atahualpa'); ?></h3>
                    </div>
                    <ul><?php wp_get_archives('type=monthly'); ?></ul>
                    </div>
                                    
            <?php endif; ?>

        </td>

        <!-- / Left Sidebar -->
        <?php ?>

        <?php if ( $bfa_ata['left_col2'] == "on" ) { ?>
        <!-- Left INNER Sidebar -->
        <td id="left-inner">

            <?php // Widgetize the Left Inner Sidebar 
            
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Left Inner Sidebar') ) : ?>
        
                    <!-- no default content for the LEFT INNER sidebar -->
                                    
            <?php endif; ?>

        </td>
        <!-- / Left INNER Sidebar -->
            <?php ?>

        <!-- Main Column -->
        <td id="middle">

<?php
 
//Code automatically inserted by Featurific for Wordpress plugin
 
if(is_home())                             //If we're generating the home page (remove this line to make Featurific appear on all pages)...
  
if(function_exists('insert_featurific')) //If the Featurific plugin is activated...
   
insert_featurific();                    //Insert the HTML code to embed Featurific
?>

<?php /* If there are any posts: */
if (have_posts()) : $bfa_ata['postcount'] == 0/* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>

    <?php /* This outputs the next/previous post or page navigation. 
    This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    
bfa_center_content($bfa_ata['content_above_loop']); ?>

    <?php /* The LOOP starts here. Do this for all posts: */
    
while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>
    
        <?php /* Add Odd or Even post class so post containers can get alternating CSS style (optional) */
        
$odd_or_even = (($bfa_ata['postcount'] % 2) ? 'odd-post' 'even-post' ); ?> 

        <?php /* This is the actual Wordpress LOOP. 
        The output can be edited at Atahualpa Theme Options -> Style & edit the Center column */
        
bfa_center_content($bfa_ata['content_inside_loop']); ?>


                        
    <?php /* END of the LOOP */
    
endwhile; ?>

    <?php /* This outputs the next/previous post or page navigation and the comment template.
    This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
    
bfa_center_content($bfa_ata['content_below_loop']); ?>

<?php /* END of: If there are any posts */
else : /* If there are no posts: */ ?>

<?php /* This outputs the "Not Found" content, if neither posts, pages nor attachments are available for the requested page.
This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
bfa_center_content($bfa_ata['content_not_found']); ?>

<?php endif; /* END of: If there are no posts */ ?>

<?php bfa_center_content($bfa_ata['center_content_bottom']); ?>

<?php get_footer(); ?>

Last edited by Rashell; Jan 1, 2010 at 08:15 AM.
  #8  
Old Jan 1, 2010, 08:08 AM
lmilesw's Avatar
lmilesw
 
10,174 posts · Jul 2009
Central New York State USA
How about Just One Category?
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #9  
Old Jan 1, 2010, 08:28 AM
Rashell's Avatar
Rashell
 
67 posts · May 2009
You wrote:

Quote:
For example, I have a page for press-articles about our culture-centre (its a german page):
http://www.kubiz-wallenberg.de/wordpress/?page_id=210
Here are only articles from this category:
http://www.kubiz-wallenberg.de/wordpress/?cat=12
Are you trying to use as a "header intro" to the category displayed on this page which you'd like to automatically feed below the "header intro".

So rather than having 2 pages they'd combine as one?
  #10  
Old Jan 1, 2010, 09:05 AM
drongo
 
27 posts · Sep 2009
okay, when I combine these three files I got a new template. this is working. I have to delete header, footer and sidebar in the template, because WP opens the page with the template only _within_ the main part, so I got two headers, two footers and two sidebars. I will try to add the part for the blog-articles there.

Sorry for my bad english. Here again what I want: I have a lot of pages. Each page descripes for example one project of our centre. Images, Texts, contact Infos and so on. And at the end of some pages should be the last articles belonging to the project, with full text and images, not only a preview. Each project gets its own category in the blog, so I can filter them.
There are also pages with press articles (I showed you) or the main page with articles about the centre.

Greetings,
Drongo
  #11  
Old Jan 1, 2010, 09:39 AM
Rashell's Avatar
Rashell
 
67 posts · May 2009
Ugghh that 2 header thing may have been my fault. I gave you poopy directions.

All you'd have to do is copy and paste the code above to a blank .php file that you can name whatever. For instance mine is lp.php

Your English is great! I'm using my site in a totally different way so I'm just trying to envision what you're wanting to do against the plugins I know are out there. There's just so many different things you can do it's hard to get your mind around all of them.

Are you trying to segment your blog, like a newspaper would? You have the Sports Section all sports related. The Lifestyle section, the Comics, the Classifieds. Each has a separate section. None overlap?

Last edited by Rashell; Jan 1, 2010 at 09:48 AM.
  #12  
Old Jan 1, 2010, 09:41 AM
drongo
 
27 posts · Sep 2009
okay, in the template under
Code:
<?php bfa_center_content($bfa_ata['center_content_bottom']); ?>
I did add:
Code:
<?php query_posts('cat=12'); //gets all posts
    load_template( TEMPLATEPATH . '/index.php'); //loads index
 ?>
Now it writes me the articles of category 12 at the end of the page where the template got applied to.
But only the short version. When I write cat=-0, as it was written in the documentary of this code, it gives me all articles, no matter which category and shows me the complete articles with images and so on. strange... but one step further.
  #13  
Old Jan 1, 2010, 09:42 AM
drongo
 
27 posts · Sep 2009
Quote:
Originally Posted by Rashell
Ugghh that 2 header thing may have been my fault. I gave you poopy directions.

All you'd have to do is copy and paste the code above to a blank .php file that you can name whatever. For instance mine is lp.php
I did. But I got a blank page when I applied it. So I did a copy of these phps.
  #14  
Old Jan 1, 2010, 09:58 AM
Rashell's Avatar
Rashell
 
67 posts · May 2009
okay, so now I'm stepping into "I really have no idea what I'm talking about" so I'll just watch and learn from here on out.

The only thing I can think of is somehow changing something from "get the excerpt" to "get the post" but what I have no idea.

So sorry.
  #15  
Old Jan 1, 2010, 11:18 AM
drongo
 
27 posts · Sep 2009
okay, I found an option in the atahualpa-settings to turn of the shortage in category-pages (which is used, when I filter by category). now I have full posts.

I am using now:
Code:
<?php 
// Which page of the blog are we on?
$paged = get_query_var('paged');
query_posts('cat=13&showposts=3&paged='.$paged);
//load index to show blog
load_template(TEMPLATEPATH . '/index.php');

 ?>
Then I thought about this: When I integrate this code in the normal index.php, it should show me these posts at the botton of every page. It worked very well. I had to change the templatepath from index.php to something like blog.php. blog.php was a copy of the index.php, but without the code from above.
Every page shows me the same 3 posts at the bottom:
http://www.kubiz-wallenberg.de/wordpress/?page_id=2
Is it possible to use a variable for the query? When I create a page, I can add variables to it. Maybe I can add a variable like "articles" and here in the index.php I ask if there is this variable at the page and if, then it uses the code from above, but implement the variable in the query. The variable should have the query, like "'cat=13&showposts=3&paged='.$paged".
  #16  
Old Jan 1, 2010, 01:37 PM
drongo
 
27 posts · Sep 2009
WORKING :-)

By default it is not possible to use the custom values outside the loop in a template. You can ask for them using the_meta(), but thats only a list of all values. With the plugin "Get Custom Field Values" you are able to get specific custom fields, for example with c2c_get_custom('fieldname').
I added to one page the custom field "articles" with the value "cat=13", if I want to have all articles of this cat at the end of the page.
Then I added to my index.php after <?php bfa_center_content($bfa_ata['center_content_bottom']); ?>:
Code:
<?php 
$articles = c2c_get_custom('articles');

if ($articles != '') {

  // Which page of the blog are we on?
  $paged = get_query_var('paged');
  query_posts($articles.'&showposts=3&paged='.$paged);

  //load index to show blog
  load_template(TEMPLATEPATH . '/blog.php');

}
 ?>
This gives the value of the customs field to the variable articles.
If this is not empty, it will add three posts of the category specified in the custom field to the page.

Thats it. Thanks for the tipps,
Drongo

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Hi all - Need help with page template witchybrit Atahualpa 3 Wordpress theme 2 Dec 3, 2009 12:05 PM
How do I create a new page template? JakeThePeg Page & Category Menu Bars 10 Sep 7, 2009 10:33 AM
Template Page with only widget abovocipher Atahualpa 3 Wordpress theme 2 Aug 23, 2009 09:12 PM
Using Page Template - where to select? Charlotte Excerpts, Read more, Pagination 1 Feb 28, 2009 01:49 PM
New Template Page Axon Atahualpa 3 Wordpress theme 1 Feb 8, 2009 01:34 PM


All times are GMT -6. The time now is 02:02 AM.


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