WordPress.org

Ready to get started?Download WordPress

Forums

Spun
[resolved] adding a fixed text area on the homepage (20 posts)

  1. hamutalwz
    Member
    Posted 11 months ago #

    Hi,
    Is there a way to add some text area at the top of the homepage - above the circles?
    a place to write a little something about the site?
    Thank you.

  2. Andrew
    Forum Moderator
    Posted 11 months ago #

    You can do this through code. If you're still interested start by creating a Child Theme.

  3. hamutalwz
    Member
    Posted 11 months ago #

    I am interested and I do have a child theme.
    can you guide me through?
    thank you.

  4. Andrew
    Forum Moderator
    Posted 11 months ago #

    Copy index.php from the theme and paste it into your Child Theme directory.

  5. hamutalwz
    Member
    Posted 11 months ago #

    and then?

  6. Andrew
    Forum Moderator
    Posted 11 months ago #

    Edit index.php from within your Child Theme.

    Do you see this line:

    get_header(); ?>

    ?

  7. hamutalwz
    Member
    Posted 11 months ago #

    I do.

  8. Andrew
    Forum Moderator
    Posted 11 months ago #

    Just underneath it add this:

    <p></p>

    Then after the <p> enter your text.
    http://www.w3schools.com/html/html_paragraphs.asp

  9. hamutalwz
    Member
    Posted 11 months ago #

    :-)
    I thought of something more dynamic than this.
    To add and area that displays text from a widget or post.

  10. hamutalwz
    Member
    Posted 10 months ago #

    any ideas how I can add a specific post or something else as text on the homepage - above the circles?
    thank you.

  11. Andrew
    Forum Moderator
    Posted 10 months ago #

    Try getting the post by the post's ID http://codex.wordpress.org/Function_Reference/get_post

  12. Andrew
    Forum Moderator
    Posted 10 months ago #

    I thought of something more dynamic than this.
    To add and area that displays text from a widget or post.

    Can you talk through how you did this? There's someone here who wants to do the same thing and I want to link that person your solution.

  13. hamutalwz
    Member
    Posted 10 months ago #

    I've added this code to my child-theme copy of index.php:

    <?php
    $post_id = 26;
    $queried_post = get_post($post_id);
    ?>
    <h2><?php echo $queried_post->post_title; ?></h2>
    <h4><?php echo $queried_post->post_content; ?></h4>

    and then I marked post id 26 as private so that it won't appear in the circles on that home page.

    however, I am looking for other ways of implementing this - not using a post. would love to hear any ideas.

  14. Andrew
    Forum Moderator
    Posted 10 months ago #

    What other content do you want to get?

  15. hamutalwz
    Member
    Posted 10 months ago #

    I would prefer not using a post for it.
    perhaps adding a text widget area there would be better.

  16. Andrew
    Forum Moderator
    Posted 10 months ago #

    Didn't you already do this 4 weeks ago when you posted this:

    I thought of something more dynamic than this.
    To add and area that displays text from a widget or post.

    ?

  17. hamutalwz
    Member
    Posted 10 months ago #

    no I didn't.
    not sure how to add a widget area there.

  18. hamutalwz
    Member
    Posted 10 months ago #

    now I've done it:
    <?php if ( is_active_sidebar( 'homepage_widget' ) ) : ?>
    <ul id="sidebar">
    <?php dynamic_sidebar( 'homepage_widget' ); ?>

    <?php endif; ?>

    and of course I registered the new widget area in functions.php:

    /*** NEW WIDGET AREA ***/
    register_sidebar(array(
    'name'=> 'homepage widget',
    'id' => 'homepage_widget'
    ));

  19. Andrew
    Forum Moderator
    Posted 10 months ago #

    Nice one! I didn't know how to do this, thanks for informing me and many others :)

  20. hamutalwz
    Member
    Posted 10 months ago #

    you're very welcome :-).

Reply

You must log in to post.

About this Theme

About this Topic