Plugin: Static front page (71 posts)

  1. Denis de Bernardy
    Posted 10 years ago #

    @wistex: as documented... :)

  2. makalu
    Posted 10 years ago #

    Here's what I want to do:

    Have a home page with some static content, and a listing of recent posts within a certain category. I was hoping this plugin would address this need.

    I installed plugin, created a page called Home and associated with a template called home.php, which begins with what I understand to be the standard "The Loop" code. This results in the contents of my home "Page" being printed to the screen. Fine.

    My home.php template then contains some code like this:

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

    In other "pages", this code will print a listing of posts within my cat_id 2 category. However, in *this* particular case, I'm simply geting a listing of a single "post" -- my single Home "page" (i.e. I'm getting a repeat of the content printed at the top of the page.)

    Any ideas?

  3. Denis de Bernardy
    Posted 10 years ago #

    that won't work, best I know, since the plugin filters the wp_query on the page detected as the home page. you could tweak it to allow it to be called only once, though. for a variety of reasons, I'd expect more bugs rather than less from that.

    why don't you use your $my_query = new WP_Query() code twice? obviously, you know what you're doing.

  4. makalu
    Posted 10 years ago #

    It may *seem* that I know what I'm doing, but I guess I really don't. :-) How would creating a second object solve the problem? Does the plugin only filter the first instance somehow? Thanks!

  5. Denis de Bernardy
    Posted 10 years ago #

    something like:

    $my_query = new WP_Query('relevant_params');
    $my_query2 = new WP_Query('cat=2&showposts=5');

    while ($my_query->have_posts())
    while ($my_query2->have_posts())

    if you use the static front page plugin, the wp_query will get filtered and bypassed on the home page.

  6. whimsy
    Posted 10 years ago #

    I have a problem similar to makulu, and I'm not sure I understand the answer:

    I'm using a wordpress install as a recipe list site. In my sidebar, I included a quick list of all the recipes. My attempts went like this:

    1. Without sem-static-front I would just have my sidebar do a new query_posts('special stuff') and a second wordpress loop. It worked great.

    2. When I installed the plugin, my list of posts (recipes) became just the static front page. [Both on the static home AND on other pages]

    3. I put this code in my sidebar:
    <?php $recipe_list_query = new WP_Query('showposts=-1&orderby=title&order=ASC');
    if ($recipe_list_query->have_posts()) : ?>
    <li id="list-posts"><?php _e('full recipe list:'); ?>
    <?php while ($recipe_list_query->have_posts()) : $recipe_list_query->the_post(); ?>
    <li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile ?></ul>
    </li><?php endif; ?>

    This fixed all the other pages, but the static homepage still doesn't show my recipe list. Is this a bug? Or am I still missing something?

  7. Andy Beard
    Posted 10 years ago #

    I class myself as a non-programmer, thus I would tend to look for a work-around.

    Can't you just use your RSS feeds to output a nice title with excerpt?

  8. whimsy
    Posted 10 years ago #

    I am looking toward a work-around for this, but no the RSS feeds won't help. I don't want my feeds to have every entry in them, but I do want the sidebar list to be complete.

  9. patung
    Posted 10 years ago #

    I've run into a little problem using the plugin. On post pages only the link back to the home page incorporates the post title in the anchor text like this:

    <li class="page_item">Post Page Title - Home Page Title

    I'm using the "classic" template with these other plugins running:
    Customizable Post Listings
    Head META Description
    Rewrite Titles


  10. patung
    Posted 10 years ago #

    Ok so I screwed up posting the code, here it is again:

    <* href="/" title="Home Page Title">Post Page Title - Home Page Title</*>

  11. 3stripe
    Posted 10 years ago #

    I have a question (sorry if this is answered already)...

    I've got the static page showing up at /index.php, and have set the home directory of my actual blog to be /jotter...

    But the static home page is showing up at both of these locations... can I make it only show up at /index.php?

    (/jotter should just be the normal homepage loop to list all the blog entries)

    UPDATE: FIXED using http://codex.wordpress.org/Pages#Making_your_blog_appear_in_a_non-root_folder

  12. slobizman
    Posted 10 years ago #

    A page of mine will normally show comments. But, once I make it the static home page, the comments disappear. Can this be fixed, or is there another static home page pluging that won't do this?

  13. ladydelaluna
    Posted 10 years ago #

    slobizman - the easiest solution to this is to make a copy of index.php and save it as home.php - the browsers will look for that before they look for index.php, and then you can have the regular comment setup, and make the other changes to your home page that way.

    you don't need a plugin for a static home page...

  14. slobizman
    Posted 10 years ago #

    Problem is though, that I need the comments to show up with the post (page). I can't have the user click the comments link first. The index.php won't do that. That's why I was trying to use the page rather than post.

  15. ladydelaluna
    Posted 10 years ago #

    have you tried setting it up doing that with the home.php page? i'm not sure if there's a difference or not, becuase i haven't tried it, but i'd venture to guess that something resembling

    <?php include (TEMPLATEPATH . '/comments.php'); ?>

    in the proper place/div should work, shouldn't it?

  16. slobizman
    Posted 10 years ago #

    Whoa...this is really strange.

    I deactivated this plugin and then installed Filosofo Home-Page Control. It worked and I entered some comments. Then, deciding I didn't like how it forced the URL to me mydomain.com/home/ instead of just mydomain.com (liek Static Home Page pluging), I decativated it.

    Then I reactivated Static Page plugin and went back to my front page, and viola!!!! the comments where still there! So deleted them all, thinking maybe this plugin needed to have at least one comment on the page to work. but, even after removing all the comments, it still showed the comment box!

    I don't know if the Filosofo plugin did something somewhere, or getting the comments in (even after deleting them) did something, but it's working.

    I'm a litle afraid of it all though as the entire site design will rely on this to work all the time. To the plugin developer: could you please comment on this when you get a chance? I'd appreciate it. Thanks.

  17. slobizman
    Posted 10 years ago #

    Well sort of fixed....this is really crazy. I hope the developer see this as it will most likely lead to a fix.

    Like I said, I had the static home page showing comments again. Happily, I went in and edited the "home" page to change the text a little. Nothing else. After clicking enter, the comments no longer showed up!

    After a bunch of testing, here is how I can get it working, after editing the page:

    1. Deactivate Static Page Plugin
    2. Activate Filosofo Plugin
    3. Go to Options/Filosofo and select the page as the static home page. Do not do any permalink changes.
    4. Deactivate Filosofo
    5. Activate Statis Page Plugin


    So, the big question is, what does the Edit Page function reset, that the Filosofo resets back, that the Static Page Plugin looks at that blocks comments?

  18. slobizman
    Posted 10 years ago #

    More info. Updating ANY post, not just the one I'm making static, makes me have to go through all the steps again.

  19. slobizman
    Posted 10 years ago #

    Well, I have a solution, that scare me to death -- I keep both plugins activated and everything works as it should.

  20. moshu
    Posted 10 years ago #

    Slobizman, check your other thread :)

  21. Denis de Bernardy
    Posted 10 years ago #

    static front page does not block comments from appearing on the front page -- wordpress does, via comments_template().

    A comment above mentions you can work around this by manually bypassing the call, i.e.

    include (TEMPLATEPATH . '/comments.php');

    but this does not work in practice, because the comment-related variables will not work.

    the following, however, should work:

    $GLOBALS['withcomments'] = true;

  22. slobizman
    Posted 10 years ago #

    Yes, that worked. But, unfortunately for me, not all the way. It works for comments_template() but not for paged_comments_template(), from the Paged Comment Plugin, which I have to use for this blog.

    I guess he uses another global variable.


  23. slobizman
    Posted 10 years ago #

    If it helps, in his paged-comments.php file he has this function, which refers to the "withcomments"

    // Load paged comments template (function based on comments_template() in comment-functions.php).
    // I had initially intended to instruct users to modify template files and include '/comments-paged.php'
    // as an argument to comments_template(). Unfortunately, for comment-laden posts, this would have been
    // inefficient (comments_template() issues a query which returns all comments for a post). A better
    // solution, for the purposes of this plugin at least, would be to have comments_template() made
    // "pluggable" (like those functions in pluggable-functions.php). This would allow me to override the
    // function if paged comments were enabled. (It would also mean users could load the plugin without
    // the need to edit any files at all.)
    function paged_comments_template($file = '/comments-paged.php')
    global $paged_comments, $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;

    $include = apply_filters('comments_template', TEMPLATEPATH . $file);
    if (!file_exists($include)) $include = ABSPATH.'wp-content/themes/default/comments-paged.php';

    // revert to original comment template if:
    // + the current context is inappropriate (e.g. post listing)
    // + template for paged comments does not exist
    if (!paged_comments() || !file_exists($include)) {
    // load comments.php from current theme folder (or 'default' theme folder if it doesn't exist)

  24. slobizman
    Posted 10 years ago #

    I think it's reverting to the original comment template in the area you see at the bottom of the code in the last section of the code above. Maybe.

    EDIT: Yup. I took out that section and it sort of worked. I displayed the comments initially, but when I clicked on for the next page of comments it had a not found. I think it's confused where everything is when the static plugin is active.

  25. Denis de Bernardy
    Posted 10 years ago #

    static front page is not intrusive on the WP workflow, i.e. it lets WP do: if not ( is_single() or is_page() ) then no comments.

    file a bug report in WP if you think there should be an easy way to display comments on the front page.

  26. tedinoz
    Posted 10 years ago #

    Odd problem.
    I'm using widgets to populate the sidebar, including one as a list of pages.
    The page with the "home" plug does appear as Home, but...
    it also appears again in the list of pages.


  27. AlisonB
    Posted 10 years ago #

    Well, not sure about this problem. Since installing static front page, "recent posts" listing doesn't turn up in the sidebar on opening page. Not sure if this is the static plug-in or what.

    I've fiddled with the code, and can get the recent posts to turn up on the front page, but then my side bar vanishes from all other pages.

    Here's the code as it now stands (minus the ad code):

  28. <?php _e('Recent Posts'); ?>
      $posts = get_posts('numberposts=5&offset=1');
      foreach ($posts as $post) :

    • "><?php the_title() ?>
    • <?php

  29. <?php } ?>
    <?php if ( !is_page ('archives') ){ ?>

    <li id="pages"><?php _e('Pages'); ?>

      <?php if( is_home() ) : ?><?php wp_list_pages('title_li=&depth=1'); ?><?php else : ?><?php wp_list_pages('sort_column=menu_order&title_li='); ?><?php endif; ?>

    <li id="search"><?php _e('Search'); ?>
    <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <input type="text" name="s" id="s" size="15" /><input type="submit" value="<?php _e('this site'); ?>" />

    <li id="categories"><?php _e('Categories'); ?>

      <?php if( is_home() ) : ?>

      <?php wp_list_cats('children=0'); ?><?php else : ?><?php wp_list_cats(); ?><?php endif; ?>

    Anyone can help?

    I tried adding
    <?php if ( !is_page ('archives')|| (is_home() ){ ?> but it didn't work.

    If I put <?php if (is_home() ( !is_page ('archives') ){ ?> in the pages and categories coding then the 'recent posts' turn up on the static page, but side bar vanishes from all the other pages....


  • Denis de Bernardy
    Posted 10 years ago #

    the latest version of the plugin fixes both of the above two issues. the plugin's page is not up to date, but the zip is.

  • tedinoz
    Posted 10 years ago #

    Thanks. Works fine with that update.

  • tedinoz
    Posted 10 years ago #

    Hi (again)

    Everything going well until this week when I uploaded a LOT of posts - many of which are dated 1700's & 1800's.
    Anyway, the earliest dated posts have hijacked my front page.

    Hmm, as I type this, I've just realised that they could well have hijacked every page that relies on the Main Index template.

    In any event, any thoughts you have about why the static front page has gone west would be appreciated.



  • 123

    Topic Closed

    This topic has been closed to new replies.

    About this Topic