WordPress.org

Ready to get started?Download WordPress

Forums

WP 1.5 Template system question (17 posts)

  1. david
    Member
    Posted 9 years ago #

    I know there has been a lot written about WP's very special, very difficult for non-technical MT users to grasp "templating system". But I can't find exactly the answer I am looking for so I will just drop the question here.

    I was to use WP as a very lightweight CMS for a peronal website. The problem is that I don't want exacly a weblog, I want a little more control and I don't want an index file that is a 10 miles long.

    Therefore I want to be able to pull content from the DB into smaller files which I can then include in my own index.php file. I will use the post and excellent link manager in wp for my own evil ends.

    The problem is that if I create a new *.php file, for example, "mylinks.inc.php" with maybe a post or link loop in it (any wp code designed to pull things out of the database), then linking to that file or trying to get that file to return anything seems kind of futile. I am sure the reason for this is obvious to all the wp geeks reading this. but I am a mere mortal, hopefull that perhaps WP can end my dependence on MT once and for all.

    It seems like WP has a fixed set of templates and template names which cannot really be changed. easily. can this be true? Please help if you can explain this "feature" and how/if it can be worked around.

    I am runningwp 1.5-beta which uses this theme based templating system...which I obviously cannot grasp.

    thanks.

  2. orangeguru
    Member
    Posted 9 years ago #

    I also came from MT to WP ... so far I am very happy ... although the difference between the VERY good template management (and splitting up code fragments) of MT is not directly in WP

    This entry in the codex helped me a lot:

    http://codex.wordpress.org/Themes

    It also helps to know the Loop:

    http://codex.wordpress.org/The_Loop

    And the template tags:

    http://codex.wordpress.org/Template_Tags

    Hope that helps a bit?

    http://codex.wordpress.org/

    PS: The codex is very cool and helpful - thanks to all it's builders!

  3. Anonymous
    Member
    Posted 9 years ago #

    This feature seems to be in a state of flux and I've requested an explanation on another thread. In 1.22 and earlier versions, you can call wp-blog-header.php from any php file in the root and any wp function will work in that file. I have a header.php, a footer.php, and various other includes making up the index page of my own site. But they now seem to be saying these files have to be put in a theme directory. I say 'seem' because frankly I'm not finding the current explanation very clear. Maybe you'll be able to make more sense of it?

  4. DianeV
    Member
    Posted 9 years ago #

    Many blogs use the same template for all pages, and so every page looks the same. As well, the Category page is set by default to include, full length, every post ever made to that category; in my view, it should be simply an index of posts in that category.

    I've detailed how to make multiple WP templates here:
    http://developedtraffic.com/resources/wordpress-notes.php

    As well, I use WP as a kind of CMS/blog thing for certain articles on my commercial website. For that, the implementation is the same -- except I've used the home page as a kind of index of articles by displaying the title and a bit of text, with a link to the full article.
    http://dianev.com/blog/

    For either of these, clever use of the template tags is the answer.

  5. orangeguru
    Member
    Posted 9 years ago #

    @Anonymous: Well 1.3/1.5 ain't finished - so no surprise if things change. ;-)

    Themes: I actually find the new system quite logical and practical. I often 'cut' my layouts in MT into the same section snippets to make it easier to edit and maintain my blogs/sites.

    If you have problems understanding themes and it's several POSSIBLE files - you can simpy pack EVERYTHING into the index.php and put your styles as usual in style.css. Activate your theme in the admin panel ...

  6. david
    Member
    Posted 9 years ago #

    Thanks orangeguru, dianeV, anon.

    OG: I couldn't get anything out of this particular link however (no content on this page), which might have been the most important one.

    http://codex.wordpress.org/Themes

    The rest are good and useful as I'll have to hack the loop eventually - and as DV notes - make "clever" use of the template tags to get the result I am looking for.

    The problem is that I am still not any closer to that stage of hacking on the loop or worry about broken archive links,etc. Right now I just basically want to be able to rename index.php to something and then have it show up in my browser.

    I think it is the theme system which is preventing that. I have tried making a new template (just a copy of index) and placed it everywhere trying to reach it without any luck. As it is now, I can actually "find" the new page (as in, no 404), but the page is empty. nothing in the src code.

    Where should you place these new templates to make them executable/reachable? I also have a feeling that this is something to do with an emerging feature.

    still thankful

  7. david
    Member
    Posted 9 years ago #

    anyone?

  8. Ryan Boren
    WordPress Dev
    Posted 9 years ago #

    See this.

  9. david
    Member
    Posted 9 years ago #

    hey Thanks. I look forward to see someone making a plug-in for managing custom templates. There was some reference in the WIKI to using plug-ins to manage these, but no more information.

    Anyone know of a plugin for this, either available or in development? I don't want to be locked into making the template names as dictated by the theme.

  10. orangeguru
    Member
    Posted 9 years ago #

  11. david
    Member
    Posted 9 years ago #

    Thanks OG. It is a very good resource but I am still not any closer to figuring this out. I get themes, and think they are great.

    ...what I don't get is how to make truly custom templates. Note: this is different from *customizing* existing templates. Let me give you an example.

    I want to make a template called "top_teasers_right_fart_.inc.php", and in that I want to place a standard WP loop, perhaps contrained to a category called "teasers"...and then I just want to include that file in my own page. Perhaps not even using WP to render my index page...just including bits and pieces of dynamic content within my own page.

    Maybe you could say that I want to use WP more as a CMS - to store, organize, and manage content. Not so much as a publishing system which requires that a template be given a certain name so that it can acticvate the right process.

    I guess what I am looking for is actually movable type. Without the rebuilding and other annoying archiving features.

    If anyone knows of a plug-in - existing or in development - which would work with 1.5 to say, make the creation and management of *completely custom* templates possible please post here or forever hold your peace.

  12. david
    Member
    Posted 9 years ago #

    Most designers who know a little PHP probably recognize the problem I am having - while to hardcore WP nerds my problem might seem elementry.

    Are there some "mappings" somewhere that say which templates should be evoking certain functions? I looked through wp-blog-header.php and it seemed as if there might be something there. Uggh. Please check the above post and if anyone know of a solution or a possible lead please let me know. I can't believe it is this complicated...it should be easy right?

  13. orangeguru
    Member
    Posted 9 years ago #

    Although I see no big problems doing this with WP, maybe you should check out Mambo?

    http://www.mamboserver.com/

    It's pretty cool - overkill to do 'just' a blog.

    If you analyse the Kubick theme a bit you'll already see commands to call up only one category in a page (check archive.php).

    Overall if you try to handle non-linear content - you should consider a real CMS instead of WP.

  14. david
    Member
    Posted 9 years ago #

    Thanks, yes, I have looked at mambo before. But maybe I should look at it again.

    I am still drawn to wordpress and MT however for their underlying simplicity - though the fact that you can't insert a simple WP loop into a file called "poop_monkey.php" and get it to spit out a list of articles is rather bothersome. Makes me question if I have just not communicated my problem clearly enough - or if the right person just has yet to come along and read it. If the new theme system in 1.5 really is so restrictive than I will definitely give WP a rest.

    I'll ask one more time.

    How the blazes do you create a file which is named something different from the names deemed acceptable by the theme system - and get it to execute the WP code contained within it....and access it from your browser. how the blazes? uggh.

    cheers.

  15. kory
    Member
    Posted 9 years ago #

    FWIW, I use Mambo on two of my sites:

    http://www.wispcentric.com (getting ready for a major upgrade)
    http://www.startawisp.com

    I'm also planning on using it for a directory site I'm working on too.

    I use WP within a Mambo wrapper (basically an inline frame) which may be seen here:

    http://www.wispcentric.com/component/option,com_wrapper/Itemid,127/

    I'm thinking about going Mambo-only for the blog as well. I love WP and have been very pleased with it but I'm finding it doesn't fit in well with the overall site model.

    HtH!

    Regards,
    Kory

  16. Randyd
    Member
    Posted 9 years ago #

    I created a archive page from my index page. Instead of having posted content, I have archive content. I took everything out after:

    <div id="content"> and added new php code
    and then made sure my div close tag was still in place.

    Then I created a new folder named misc-style and a new style sheet named style.css. For the items I didn't want to show, I just added a hidden value for visibility in the css. Then I replaced the call to style code in the head section of the file with my new code:

    <style type="text/css" media="screen">
    @import url( <?php echo get_settings("siteurl"); ?>/misc-style/style.css );
    </style>

    After that you can name the file what you want and grab it with a link. Oh and make sure this new file is in the root directory that wordpress is in.

    Hope that helps

    Randyd

  17. david
    Member
    Posted 9 years ago #

    Yes, thanks Randyd.

    But I think it must either be....

    1) something to do with 1.5
    2) some obvious error on my part or my config...

    You'd think it would be exactly that simple,...that one could in fact just rename index.php to, for example, "poop_monkey.php", and then just leave that file on the root of your web dir and point your browser to it and boom.

    Just when *I* do that I get a completely empty page. I mean EMPTY. without a single byte. It can find the page...it just can't process it to any output.

    does this have anything to do with the fact that in 1.5 the only thing living in index.php is...


    <?php
    /* Don't remove this line. */
    require('./wp-blog-header.php');
    ?>

    Ah shucks....I guess this can't be done in WP. Seems so simple. Thanks to everyone who has tried.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.