WordPress.org

Forums

wordpress as cms (23 posts)

  1. evvo1961
    Member
    Posted 9 years ago #

    I am using wordpress as a CMS and am using the static home page plugin to have a fixed home page (home.php). Other pages make up my main navigation including a page called blog (blog.php) that i want to be my main entry point to my posts.

    The blog page currently shows the same content as my home.php page although it does show the category and archive links in the sidebar. how do i get this page to show the list of recent posts on its first page as it would do normally? The content for blog.php page contains no content as such so not sure why its picking up the home page content.

    Do i need some code added to the page template to recognise this blog page or do i need to create the blog home page some other way?

  2. graemep
    Member
    Posted 9 years ago #

    I think you trying to implement two different methods of controlling what is shown on your blogs home page at the same time.

    One is to use a plugin, the other is to create a template called home.php.

    I assume you are using Denis de Bernardy's plugin. If so look at the instructions again. http://semiologic.com/software/static-front/

    Incidentally, when he says "Create a page titled 'Home'" he means a page within wordpress - i.e. created from the WordPress Admin "Write Page" page.

    You should probably look at the documentation on templates at on pages.

  3. pcmt
    Member
    Posted 9 years ago #

    WordPress doesn't need a plugin to be used as a CMS. It is already a CMS. And it doesn't need a static homepage. The homepage URL can be the default root-level WP homepage URL but with a custom loop (or loops)... to present whatever content you like in whatever way you like.

  4. evvo1961
    Member
    Posted 9 years ago #

    I did follow the instuctions and created a blog.php file that was the template for my blog page. this however made all my archive and category links fail. it was as if it was looking in the wrong path for the files.

    i may abandon this static page method and do as pcmt pointed out, and code it within the loop.

    does anyone know of a tutorial or explanation anywhere of how to do this?

    basically i want a combination of website (pages in wordpress) and blog (posts, categories, archives) as a separate link on the website.

    i originally had my website outside of wordpress and simply linked to wordpress for my blog but am looking for a more unified coherant entity by trying to incorporate the site in wordpress.

  5. pcmt
    Member
    Posted 9 years ago #

    You really need to be familiar with ways to use the WP Loop: http://codex.wordpress.org/The_Loop

    It can be used more than once on a page, to pull out any content you like. It's also worth learning how to create new page templates, and then use your own loop(s) within them: http://codex.wordpress.org/Stepping_Into_Templates

    These ways, WP can do almost anything (with some CSS styling thrown in, of course).

    Added: another tip, if you're going this way, is to remove the sidebar system of auto-generated links to pages, categories, and archives altogether, and to use the external "links" method to build your internal navigation... otherwise the sidebar gets too fussy - fine for a blog but more control is available with WP "links".

  6. evvo1961
    Member
    Posted 9 years ago #

    thanks, i think you have solved it for me with the use of templates... so i presume i could create a blog.php template with the standard loop within it and build my blog 'home' page from that?

    i am more familiar with the sidebar links and have managed to use conditional tags to get various different sidebars / links for different pages.

    will read up on loops and templates a bit more then have another go later...

  7. pcmt
    Member
    Posted 9 years ago #

    "i presume i could create a blog.php template with the standard loop within it and build my blog 'home' page from that?"

    Yes, I believe so.

  8. evvo1961
    Member
    Posted 9 years ago #

    hi,
    i had a go at creating a blog.php template with the loop copied from index.php (ie the standard posts loop) but my page created from this only contains a link that links to itself, no posts at all.

    any ideas what i have done wrong?

    clicking on category or archive links work fine, posts show correctly from these areas, but just do not display within my blog page.

  9. pcmt
    Member
    Posted 9 years ago #

    Not sure what the problem might be. In one of my page templates I've used this:

    <div>

    <?php $my_query = new WP_Query('cat=7&showposts=10');
    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

    <div class="entry">

    <?php the_excerpt(); ?>
    <a href="<?php the_permalink() ?>" title="Continue reading <?php the_title(); ?>">Continue reading &raquo;</a>

    </div>
    </div>

    <?php endwhile; ?>

    </div>

    It works okay. It shows excerpts for the first 10 posts in category 7, which obviously can be adjusted to suit.

    Above this, I have the default WP loop with a bit of written Page content, which acts like a sticky.

  10. evvo1961
    Member
    Posted 9 years ago #

    ok thanks,

    i read more on the loop and saw examples like this in addition to posting from a featured category, but hoped to get the 'basic' loop working before tinkering with more advanced variations.

    will try your approach anyway.

    im still using the static page plugin, i may try the other method of using the is_home tag in index.php to recognise my home page and also check for my blog page before doing the basic loop rather than coding in a separate template file. that may create what im trying to do...

  11. evvo1961
    Member
    Posted 9 years ago #

    not having much success with this, the loop of posts wont appear on any other page i designate in the code of index.php. are there any other places i need to make changes to achieve this?

  12. evvo1961
    Member
    Posted 9 years ago #

    any other recommendations for having a web site AND blog on same system? i saw a system called drupal... anyone know or tried this?

    any other suggestions?

    saw textpattern but seems to use a strange syntax called textile...

  13. MichaelH
    Member
    Posted 9 years ago #

  14. evvo1961
    Member
    Posted 9 years ago #

    im looking for more of a easy to understand tutorial really. i know php and have read all the wordpress docs time and again but cannot get the loop to appear on any other page whether i code in index.php or page.php

    someone must have achieved it, i can easily use it as a CMS by just using pages OR a blog (posts) but cant seem to get both working on same system.

    im trying to get the posts from the home page into a separate page now, ie url/blog and have a static home page like a normal website.

    maybe pages are the wrong way to go, and categories may need to be my main links?

  15. pcmt
    Member
    Posted 9 years ago #

    Basically, I'd say stick with WordPress and keep reading the Codex. It's all there. Drupal and Textpattern are just different versions of the same ballgame. Be brave. Choose one, and stay with it.

  16. lisavollrath
    Member
    Posted 9 years ago #

    I'm using WordPress as a CMS, with a home.php template for my main page, which only displays one category, called News. The posts I want to display on the main page go in News, and I use a sticky plugin to keep my featured item in that category on top.

    Lisa
    http://www.lisavollrath.com

  17. marchern
    Member
    Posted 9 years ago #

    hello everyone, this thread is very pretinent and useful. i've followed in evvo1961's footsteps but am stuck somewhere.

    i don't know what code to put in home.php. i tried using code put out in codex for pages, but doesn't work. also cut and paste code from pages.php, but still doesn't work. the problem is that i only half understand (yes, after reading lots of codex) how certain things are done. i also read the loop and templates, but just need some help before it begins to make sense to me and i can do it by myself.

    IMPT: now, i'm at a place where i know how to use the side bars to change what's shown in the body of the page. but i don't know how to allow the body to do all the work, like what pcmt was mentioning.

    here are my needs:
    1) i want to be able to link to my pages in home.php, where home is the place where i can just create links to all other pages, sub pages. can someone give me simple set of code for home.php? (i'm modifying kubrick) when it's given, it's easier to make sense of it and learn. thanks so much.

    2) i don't know how to think of home.php in a wordpress context. normally, blogs pop up and that's due to
    get_post() function. i suppose i have to insert code like get_home() in index.php, and wp_list_pages (since i want to put pages in home) in home.php. but still i don't really know how to code it. do i put it within the <?php while (have_posts()) : the_post(); ?> loop or where? i'm lost here.

    3) anyone able to give a schema and/or code to help me through these tough times?

    much appreciated.

  18. pcmt
    Member
    Posted 9 years ago #

    I'm not sure what the problems are. The Codex says "WordPress can be configured to use different Page Templates for different Pages. Toward the bottom of the Write->Write Page administration panel is a drop-down labeled "Page Template". From there you can select which Template will be used when displaying this particular Page."

    It's a matter of reading the relevant parts of the Codex, to make a new template (in my case, a Page template) and to configure the WP Loop within that template to display whatever you like, whether it be blog posts or something else. Note that the default page.php already has a loop in it, so just save that as a new template and make a new loop.

    Then create a new Page, selecting that particular template. It needn't have any content of its own, if you have a suitable loop to retrieve the content you actually want.

    And then for navigation, the WP external links system can be used instead of the "blog-like" sidebar sections for Pages, Categories, and Archives.

  19. marchern
    Member
    Posted 9 years ago #

    ok, i don't think i fully understand your answer because i'm very new to this. i'll streamline my questions to something very specific. the answer to this will help me understand what i need to understand. the first question is:

    let's say i have a home.php page that i create from notepad. let's say the code inside is the same as links.php i.e.

    <?php
    /*
    Template Name: HOMEPAGE THAT GIVES EXTERNAL LINKS
    */
    ?>

    <?php get_header(); ?>

    <div id="content" class="widecolumn">

    <h2>Links:</h2>

      <?php get_links_list(); ?>

    </div>

    <?php get_footer(); ?>

    i understand all the code above. i just don't know how to put a function in index.php that will call up home.php as the front page.

  20. marchern
    Member
    Posted 9 years ago #

    if i can do the above, then all i need for having a homepage that lists the pages is to use the include_pages() functon that can be installed as a pluggin.

    then i'll have a homepage (run entirely by wordpress, template included) that links the the pages as i need them.

    thanks.

  21. bestfoot
    Member
    Posted 9 years ago #

    I have found the best way to use WordPress as a cms is this:
    1. standard install of WordPress.
    2. get semi-static home page plug in and create a wordpress page (ie in the dashboard, click on write, page, content in that page. Once you enable that plug in the page you created with the title home will become the home page. It is really based on the slug. Once the page is created you can edit it and change the name because the slug will stay the same.
    3. use the fold_page_menu plug in and only have so many base pages and then sub-pages under those main pages.

    Works great for me.

  22. Ming
    Member
    Posted 9 years ago #

    @marchern: As long as home.php exists WordPress will use that template for the front page. Just make sure it's in your active theme directory. You can delete the following comment lines. WP doesn't need them for recognized templates like home.php, index.php, etc.


    <?php
    /*
    Template Name: HOMEPAGE THAT GIVES EXTERNAL LINKS
    */
    ?>

  23. marchern
    Member
    Posted 9 years ago #

    so i guess that for external links, i'll just link to my root and the php page that's in there. yes?

    bestfoot, great site, i'll read more on it. as for using wordpress as cms, i've managed to do it. i'll go figure the fold_page_menu pluggin

    ming, thanks for the input. i understand now.

    and all, thanks for the input. it really helps give direction.

Topic Closed

This topic has been closed to new replies.

About this Topic