WordPress.org

Support

Support » Themes and Templates » How to add text widget to home.php

How to add text widget to home.php

  • FaTFoX666
    Member

    @fatfox666

    Hi!
    I’m not familiar with PHP so I need to ask this. How can I add only that basic WP text widget to my home.php? And if the widget is not used how to display nothing?
    Sry my english.

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi
    Forum Moderator

    @esmi

    Do you want this widget to display in your sidebar or within the page content area?

    if the widget is not used how to display nothing?

    You should edit sidebar.php

    How can I add only that basic WP text widget to my home.php?

    As I could understand you want a link to your homepage in your sidebar.If so, choose to add text or image and link.
    Codes would be
    <a href="/index.php">Home</a>
    or
    <a href="/index.php"><img src="file.jpg" width="100px" height="100px"></a>

    I’m not sure if I understood correctly what do you want to do, your english is not very perfect 🙂

    FaTFoX666
    Member

    @fatfox666

    I don’t want to include whole sidebar on home.php page, I need only to make info tab top of the page where widget text should come.
    Something like this in home.php file

    <div id=”page”>
    <div id=”header>
    <?PHP *How I include widget here?* ?>
    </div>
    <div id=”rest of the page…”>
    </div>
    </div>

    home.php will be my homepage and uses different CSS and layout than rest of my pages. It is like “wellcome” page where is info tab which content can be changed.

    esmi
    Forum Moderator

    @esmi

    Try:

    <div id="page">
    <div id="header>
    <?php get_sidebar('home'); ?>
    </div>
    <div id="rest of the page...">
    </div>
    </div>

    Then create a page called sidebar-home.php:

    <div class="sidebar" id="home_widgets">
    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) : ?>
    <?php endif; ?>
    </div>

    That should give you a second sidebar on your Home page that you can add widgets to.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to add text widget to home.php’ is closed to new replies.