Forums

Static Front Page makes Blog Lose Original CSS (24 posts)

  1. Zuckerman
    Member
    Posted 7 months ago #

    Hey Folks,

    I’m trying to clear the final hurdle here of tweaking a theme called Minimatica.

    It appears that when you make the home-page static (via the Reading Settings) it then causes the Blog to lose its original CSS. It kind of looks like it did before the static switch but it loses the header, a cool flag with the date on it that wraps around the posted thumbnail, some shadows in the thumbnail, as well as some basic formatting. This also is affecting the CSS of the front-page a bit.

    Having been at this for days I am certain that the problem lies somewhere in the loop.php as the index calls it up.

    However, I am quite new at this and have basically been teaching myself WordPress and a little CSS by way of building my father’s site, bartmidwood.com

    As far as I can tell, most folks using Minimatica pretty much opt to put the blog on a subdomain. But I’ve managed to get the blog working and keep it in-house. Just need to solve this final bit.

    Any takers?

    Here’s my index and my loop:

    [please post chunks of code at pastebin.com]
  2. Samuel B
    moderator
    Posted 7 months ago #

    did you also create an empty "Blog" page that your posts are assigned to?
    ref
    http://codex.wordpress.org/Creating_a_Static_Front_Page

    When you create a static front page for your site, you must also create a way for WordPress to show your most recent posts in a "virtual directory" called blog, news, or whatever else you choose to call it. This is true whether or not you are actually using Posts in WordPress.

  3. Zuckerman
    Member
    Posted 7 months ago #

    Hey Samuel,

    Thank you for the quick response. I did indeed. However, I've read in a couple places that index would override this. It's true as far as I can see because no matter what I put in the blog.php which is attributed to the blog page.. nothing changes. But when i mess around with the index or the loop things start happening -- just not what I want.

  4. Samuel B
    moderator
    Posted 7 months ago #

    it's a virtual directory
    you must create an empty page titled "Blog" and assign that page to your posts
    dashboard - settings - reading

  5. Zuckerman
    Member
    Posted 7 months ago #

    That's exactly what I did.

    EDIT: But I also created a blog.php which I attributed to the Blog Page in an attempt to override the index. I've tried it with the blog.php and without. But always have had the blog Reading Settings pointing to my blank Blog Page.

  6. Samuel B
    moderator
    Posted 7 months ago #

    ah...I see - you can't assign a template to the blog page but it should work as described
    can you supply a link to look at it?

  7. Zuckerman
    Member
    Posted 7 months ago #

    I did in the 1st post :)

    http://bartmidwood.com/ then click on blog

  8. Samuel B
    moderator
    Posted 7 months ago #

    I think your problem may be that the bog page is linking to blog-2

    I assume you deleted the original, yet still being in trash a blog-2 was incremented
    empty your trash and recreate the "Blog" page

    I have to go for a few hours but will check back later

  9. Zuckerman
    Member
    Posted 7 months ago #

    2 things:

    1) didn't solve the CSS problem
    2) totally answered why the bleep I kept getting a blog-2 page! thank you.

    Here's the code again but on pastebin:

    INDEX
    http://pastebin.com/6cYxaAbw

    LOOP
    http://pastebin.com/2uLu9P1A

  10. Zuckerman
    Member
    Posted 7 months ago #

    I had to create a page called welcome and change home.php to welcome.php which i attributed to the welcome page to do the static switch with this theme.

    So, I tried sticking the home.php back in, just to test -- knowing it would conflict.

    What happened is the minor home page Css problems were fixed. However, as I suspected there would be a conflict and when I click on blog it takes me back to the home page.

    The site is obviously defaulting to the the index.php when I change home to welcome. So I tried replacing the index code with the home code. Didn't make a difference. And it doesn't mater what template I attribute to the welcome page nothing changes. Something, somewhere must be calling up the home.php to apply the correct CSS and if it doesn't find it it goes to index and for some reason things get strange. I just don't know where. Does this make sense? Do you agree? Any more thought?

    EDIT: on second thought it doesn't make sense 'cause if it then defaulted to index and i had the home code inserted in there that should do the trick. it does seem to have something to do with the home.php though.

  11. Daniel
    Member
    Posted 7 months ago #

    Try keeping the home.php which and creating a separate front-page.php file.

  12. Zuckerman
    Member
    Posted 7 months ago #

    Hey Daniel. Thanks for replying. I created a front-page.php and inserted the home code -- was that what you were suggesting? I tried keeping both that and the home.php up and I tried it without the home.php. It still has the same effect. Were there other steps? If not, any other ideas?

  13. Daniel
    Member
    Posted 7 months ago #

    Try inserting the content from page.php in front-page.php

  14. Zuckerman
    Member
    Posted 7 months ago #

    no that didn't work. i also tried inserting the code of several other relevant php files.

    i then toyed with reversing the static page setting, making a blog_template -- which i attributed to the blog page-- and tried several variations of code-- home, index, page etc. that didn't work either.

    maybe we could just add the css to a blog_template? Or something like that? i dunno i feel it's so close.

  15. Daniel
    Member
    Posted 7 months ago #

    I feel you're doing something wrong you're missing. The WP template hierarchy is pretty stable and can't get ignored just like that.

    In your source I see the template is only partially loaded.
    Does your template have this code?

    <?php get_header(): ?>
  16. Chip Bennett
    Member
    Posted 7 months ago #

    So, first things first: for what you want to do, you shouldn't need to touch the Theme's PHP files at all. If you're creating "home.php" or "blog.php", you're doing it wrong.

    Second, please note that, if you do create PHP files and add them to the Theme, certain filenames are reserved as part of the Template Hierarchy. For example, in WordPress parlance, "home" refers not to the site front page, but rather to the blog posts index page. So, if you create a home.php template file, WordPress will use that page to render the blog posts index.

    Third, note that the Template Hierarchy for the site front page and blog posts index page has its own rules, and static Pages assigned to display the site front page and blog posts index page will adhere to the Template Hierarchy, overriding any custom page templates you attempt to assign to the static Page.

    So, even if you create a blog.php template file, and assign it to a static page named "Blog", to which you have assigned the blog posts index, WordPress will instead use first home.php, and second index.php, and will not ever attempt to use a page template assigned to the static Page.

    To troubleshoot what's wrong, I would recommend doing the following:

    1) Remove from the Theme any custom template files you have created, such as blog.php, 'home.php', front-page.php, etc.
    2) Ensure you have created static Pages named "Blog", and "Front Page"
    3) Go to Dashboard -> Settings -> Reading, and ensure that the site is configured to display a static page as the front page, and that you have assigned "Front Page" to display the front page, and "Blog" to display the posts page.
    4) Go to Appearance -> Theme Options and change "Home page view" to "Blog"
    5) Check the output.

  17. Zuckerman
    Member
    Posted 7 months ago #

    @ Daniel Yes. You must have viewed the page when I was trying out different combinations. But, yes, absolutely.

    @ Chip Thank you so much for your reply. I tried everything you suggested. I removed all my own personal custom php files, ensured I had Blog and Front Page pages, configured the static settings, and went to appearance and changed the home page view to blog.

    This didn't ultimately achieve what I was looking for. And having blog set on the homepage view doesn't display the slider which is the reason I'm using this theme.

    If I set the homepage view to gallery and I have the Front Page page with a custom page template (which has the code from the theme's original home.php code). Then the site looks and behaves as it should... except, once again, for the blog CSS. If I don't have the template then the page just says "Front Page" on the header and displays no loop.

    The only hacks I've made to the code is on the loop-slider.php by replacing

    <?php query_posts( $args ); ?>

    with this:

    <?php
    if ( is_front_page() ) {
    query_posts( array ( ‘category_name’ => ‘featured’, ‘posts_per_page’ => -1 ) );
    }?>

    All this does is forces the pics in the slideshow to only pull from a specific category.

    But if I put this back to normal it doesn't seem to change the problem at hand.

    You can view the site now at bartmidwood.com and I won't mess with it until I get another suggestion.

    I'm more than happy to post all of my settings as well as ay php files.. as the theme comes with a quite a few custom phps.

  18. Chip Bennett
    Member
    Posted 7 months ago #

    This didn't ultimately achieve what I was looking for. And having blog set on the homepage view doesn't display the slider which is the reason I'm using this theme.

    The Theme doesn't appear to display the slider on static Pages, so if you want to use a static Page as the site front page, and have the front page display the slider, you'll have to add some customization.

    I would strongly recommend doing this customization as a custom front-page.php template file.

    If I set the homepage view to gallery and I have the Front Page page with a custom page template (which has the code from the theme's original home.php code).

    To start: try copying home.php, as front-page.php.

    Modify it by removing the if/else conditional wrappers, and referenes to the Loop. You should be left with this:

    get_header(); ?>
    <div id="slider">
    	<?php get_template_part( 'loop', 'slider' ); ?>
    </div><!-- #slider -->
    <?php get_footer(); ?>

    Then the site looks and behaves as it should... except, once again, for the blog CSS. If I don't have the template then the page just says "Front Page" on the header and displays no loop.

    The only hacks I've made to the code is on the loop-slider.php by replacing

    <?php query_posts( $args ); ?>

    with this:

    <?php
    if ( is_front_page() ) {
    query_posts( array ( ‘category_name’ => ‘featured’, ‘posts_per_page’ => -1 ) );
    }?>

    All this does is forces the pics in the slideshow to only pull from a specific category.

    You actually made a second change, that may or may not be impacting the slider output:

    ‘posts_per_page’ => -1

    Try changing that back to:

    ‘posts_per_page’ => 4

    i.e.

    <?php
    if ( is_front_page() ) {
    query_posts( array ( ‘category_name’ => ‘featured’, ‘posts_per_page’ => 4 ) );
    }?>

    ...and see if that helps fix the layout.

  19. Zuckerman
    Member
    Posted 7 months ago #

    @ Chip. Followed your suggestion to the letter. It is pretty much one of the methods I'd already tried -- but I tried it again. Still, no dice.

    It did remove the need for the custom template attributed to the Front Page page.

    Also changing -1 to 4 had no immediate visible effect.

    EDIT: This is how the blog should be styled -- sans the striped background. Although this is actually a categories pages. http://www.janjaapvanassen.com/?cat=4

    @ Daniel Hey, Daniel. Minimatica is your theme, yes? Have you been able to get this to work on your end?

  20. Zuckerman
    Member
    Posted 7 months ago #

    Daniel,

    Would you be willing to test this out on your end? It should be very simple with a fresh install of your theme to:

    1) Make a Welcome Page (or Front Page) and a Blog Page

    2) Go to reading Settings and make the site static

    Then, perhaps, you could see quite clearly what is amiss.

    I have read many posts of others wanting to do what I want to do with with Minimatica. However, every site I've seen utilizing Minimatica is hosting their blog on a subdomain. Obviosuly, there's a common problem that no one yet seems to have figured out.

  21. Daniel
    Member
    Posted 7 months ago #

    What you're saying should work without problems and without modifying the original theme. All you have to do is make the setting properly in Settings > Reading.

  22. Zuckerman
    Member
    Posted 7 months ago #

    So you keep saying. But it doesn't. I've just created a completely fresh install of WordPress and installed and activated Minimatica.

    I created a Blog Page and a Front Page. I then went to reading settings, ticked "a static page", made "Front Page" the front page and "Blog" where the posts go. I also created one post in Posts with a featured image attached to it.

    Under Theme Options I chose Gallery for Home Page View.

    I did nothing else. This is what it looks like it without any modifications.

    Front Page:
    http://baldissimo.com/

    Blog Page
    http://baldissimo.com/?page_id=5

    Now, I also tried Home Page View as Blog. And it caused the Blog Page to display the loop without any of the original CSS.

    So, Daniel, I beg of you, if you have the chance, please, look into the matter.

    Again, No one who uses Minimatica with a static front page has a blog on the same domain. That should tell you something.

    EDIT: to be clear my original install is still at http://bartmidwood.com/

  23. Zuckerman
    Member
    Posted 7 months ago #

    Part of the mystery here is that PAGES don't carry the same CSS as POSTS. And since we've made the site static and associated posts with a PAGE the blog doesn't have the original POSTS CSS.

  24. Zuckerman
    Member
    Posted 7 months ago #

    M last post unless someone comes up with another solution or Daniel responds...

    I have a temporary fix. I'm going to remove the static setting and categorize every blog post under the category BLOG. This will get me the CSS I'm looking for. Although I won't have a Mysite/Blog but a MySite/Category/Blog. "But them's the breaks."

    I really hope you get a chance to look at the theme Daniel. I hope I'm wrong that there's something amiss in the code that's preventing a smooth static transition. Again I have not seen a single Minimatica themed site that has a static front page with properly CSSed blog page -- unless the blog is hosted on a subdomain. In fact there's even a couple user made tutorials about Minematica where they expressly say to put the blog on a subdomain.

    If it really is that simple perhaps you could demonstrate. Because i really do love this theme.

    Thank you everyone who contributed and gave this a shot.

Reply

You must log in to post.

About this Topic