• Resolved Steve

    (@stif)


    Hi I’m completely new to WP and have average skills in web development.
    I have been learning wordpress over the last week or so using online tutorials and sites. I have just began migrating my site to wordpress using a blank theme.

    I have the theme looking the way I like it and I have a basic understanding of wordpress. There a few things I’m having trouble with.

    I have added:

    function new_nav_menu_items($items) {
    	$homelink = '<li class="home"><a href="' . home_url( '/' ) . '">' . __('Home') . '</a></li>';
    	$items = $homelink . $items;
    	return $items;
    }

    To my functions.php file
    This does exactly what I want it to do (adds the home link to the nav menu)

    My question is that my home.php page currently has static content. I would like to remove this static content and be able to add dynamic content from wordpress.
    How do I go about doing this? Do I need to change the above code and create a “Home page” from wordpress and add it to the menu from there?

    I appologise if this is a silly question.
    TIA

Viewing 6 replies - 1 through 6 (of 6 total)
  • I would first recommend reading up on the WordPress Template Hierarchy.

    In WordPress, home refers NOT to the site front page, but rather to the blog posts index, and the home.php template file is a reserved filename, as part of the Template Hierarchy.

    What you need to do next depends on what you want to display on your site front page: do you want to display your blog posts index, or do you want to display a static Page?

    You’re talking about 2 different things here. The navigation and the content.

    To set up a home page, go to pages, create a new page call it home and add new content.

    Then go to settings > reading and choose the radio button “Use a static page”. The with the drop down, choose the home page.

    With regards to your navigation, I would just use a custom menu. It’s way simpler.

    With regards to the blank theme, you should check Automattic’s _s theme. It’s came out only a couple of weeks ago and has everything set up very well.

    Thread Starter Steve

    (@stif)

    Hi, thank you both for your help.

    Indeed I would like a static page for my home page.

    I have taken the advice from Christine by creating a home page and setting it as a static page. I then made a home-page.php template page and set it as the template for my new WordPress home page as its different to the rest of the site.

    I’m a little confused with editing content on the page from WordPress.
    My site layout looks like:
    Logo
    Navigation
    Image Slider
    Introduction Content
    Additional Content
    Footer
    With of course a sidebar down the side

    It’s a fairly standard site layout. If I edit the home page content from WordPress my content changes as expected and whatever I enter appears were my introduction content is.
    (I’m not sure if I’m explaining this well, but if I enter “Hello World” in the WordPress Home page, “Hello World” appears in my introduction content.)

    However I’m confused on what code needs to be added to my home-page.php template to let me edit the additional content section of the page from the WordPress back end. Can this be done? Or do I need to create some sort of widget and then place the code into my additional content section of home-page.php?

    Once again sorry if the question is unclear or has an obvious answer any advice or tips is appreciated.
    TIA,
    Steve

    First, read the Template Hierarchy Codex entry I linked, above. You need to rename home-page.php as front-page.php.

    What is the “additional content section”? I assume you’re using <?php the_content(); ?> to output the “introduction content”?

    Thread Starter Steve

    (@stif)

    Thanks again for the reply.
    I plan to look through your link this evening after work.

    You are correct, I am using <?php the_content(); ?> to output the “introduction content”

    At the moment I plan to have either special offers or services I can offer within the “Additional Content” section. But would like to be able to edit all the text on the page from the wordpress home page.

    Some of my other pages follow a similar structure for example my services page has an introduction paragraph at the top and again an “additional content” section which I would like to add to the bottom, were I can insert the different services I can offer.

    What I am unsure about is if should I enter all the text belonging to a particular page into the word press text editor and the maybe extract sections of it to particular places on my page, or maybe make a lot of custom fields and enter the text for the additional content in them and insert the custom fields into my template?

    TIA

    Thread Starter Steve

    (@stif)

    Hi Just an update on my issue.

    I have followed the correct format for my sites hierarchy
    found at: https://codex.www.ads-software.com/Template_Hierarchy

    I also found some plug-ins which which seem to offer the kind of functionality I am looking for.

    They allow you to have multiple content areas on a single page and edit the areas from the wysiwyg text edit boxes in wordpress.

    https://www.ads-software.com/extend/plugins/multiple-content-blocks/
    https://www.ads-software.com/extend/plugins/secondary-html-content/
    https://wpmu.org/create-a-more-flexible-cms-with-wordpress-using-multiple-editable-content-blocks/

    Hope these help anyone else with the same issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom Theme Migration’ is closed to new replies.