WordPress.org

Ready to get started?Download WordPress

Forums

How to add text widget to home.php (5 posts)

  1. FaTFoX666
    Member
    Posted 4 years ago #

    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.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

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

  3. rate4d
    Member
    Posted 4 years ago #

    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 :)

  4. FaTFoX666
    Member
    Posted 4 years ago #

    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.

  5. esmi
    Forum Moderator
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.