0

I just started to work with Wordpress (Theme Development) and due to awesome functions like bloginfo('description') and others my static homepage looks a lot like a regular site, but editable with the Wordpress Dashboard.

But now, I want to put more information on my homepage which I can edit through the dashboard. I guess this is really basic Wordpress and that a simple Wordpress function or MySQL-query should be enough, but I can't seem to find it.

This is my code right now:

    <div class="fp-container">
    <div class="fp-border">
        <h1 class="fp-description"><?php bloginfo('description'); ?></h1>
    </div>
    <div class="fp-text">
        <p><?php bloginfo('description'); ?></p>
    </div>

As you can see, between the '< p>' and '< /p>' I call the description for the second time, how can I call another string that can be entered through the Dashboard?

I've asked this question on stackoverflow.com, and the only answer I got was that I should use the_content(), but that only works once, and I will need multiple text boxes on my frontpage. How can I do this?

Rik

1

There are a lot of ways to add "sections" to a page. You question is really very broad. I'll try to give you some idea but you will have to research most of them here and on the Codex as I don't have time to write code for each option.

  1. Widgets. One of the simplest ways to create sections of content is with widgets. You can identify where the widgets should show up via code in the page template and then fill the space by placing widgets in the backend via the "Appearance->Widgets" panel.
  2. Post content. Your page has a block of content built in already. Just create a Loop to display it.
  3. Custom meta fields. Your page should already have meta field capabilities. Use it.
  4. Multiple Loops. You don't have to use just one Loop for content. You can create multiple secondary Loops.
  5. Child pages. Use child pages to pull extra content into the page via a secondary Loop.
  6. Dedicated post type. Like the child page option above but using a custom post type. Something like this: https://wordpress.stackexchange.com/a/211911/21376
  7. Options. This is very similar to what you are doing already but you would need to write all of the code, including the backend form.
  8. Theme customizer. You can also add similar options via the theme customizer.
1

Welcome to WPSE Rik.

What you are looking for are custom fields. This provides you with additional areas to enter data outside of the main content editor/metabox. WP Codex to get started here: https://codex.wordpress.org/Custom_Fields

While custom fields are fully functional w/o any type of plugin, Elliot Condon has developed a fantastic plugin called Advanced Custom Fields (ACF). https://wordpress.org/plugins/advanced-custom-fields/

As you are just getting started with WP, you may want to dive into the code aspects of working with WP's custom fields directly. This will equip you to write your own custom applications.

The ACF plugin is a very popular alternative that allows you to create very advanced layouts and content entry screens quite easily without a great deal of code.

  • ACF also stores data in a way (serialized) that makes it very difficult to manage in any but a simple save-and-retrieve way. There are numerous questions here (mostly off-topic) where ACF's habit of storing serialized data has become a problem. – s_ha_dum Dec 29 '15 at 15:29
  • Thanks! The custom fields are indeed what I'm looking for. The plugin is something for when I know more about Wordpress, I prefer writing the code myself at this point. – Rik Nijhuis Dec 29 '15 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.