WordPress.org

Ready to get started?Download WordPress

Forums

Remove code that calls widget and call content in div (14 posts)

  1. Martin1
    Member
    Posted 3 years ago #

    Hello all,

    I am trying to achieve something I am personally not capable off.

    This is part of the code I have in the homepage of my site:

    [code moderated as per forum rules - please use the pastebin. if you post small amounts of code here directly, please use the 'code' button to mark it properly.]

    Part of this code calls in a widget that displays content on my homepage. Using a widget to place information on a homepage is a rather strange way of placing text on the homepage. I simply want to use the editor of WordPress to place text in the homepage.
    What was suggested to me, was to place inside the code that calls the widget a div and call the content inside that div and style as necessary. However I am out of my depth here.

    Could anyone point me in the right direction?

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    The code you posted won't add any default content in the Widgetized sidebar, so if you don't have any Widgets defined for that sidebar, then nothing will display.

    From your dashboard, go to Appearance -> Widgets, and remove any Widgets from the sidebar, if you don't want them to appear.

  3. Martin1
    Member
    Posted 3 years ago #

    I have no sidebar on my homepage I do have the option to add a tagline. I also have the option to add a widget which can contain text that then will be displayed on the homepage.

    I don't want this I just want to add text to the homepage by going to Pages > Home and write whatever I want and have it appear on the Homepage.

    Now if I want text to appear on the homepage I need to use a widget.

    The Full code of the homepage can be found here (I have no idea how to post code here in a way that is allowed so I just post a link).

    http://wordpress.pastebin.com/svLRKK24

    [code moderated as per forum rules - please use the pastebin]

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Yes, you do have a sidebar on your homepage. That's what this bit of code does:

    <?php if ( ! dynamic_sidebar( 'Homepage' ) ) :  endif; ?>

    Go to Dashboard -> Appearance -> Widgets, and ensure that you don't have any Widgets added to a sidebar called "Homepage".

  5. Martin1
    Member
    Posted 3 years ago #

    I indeed see I sidebar widget area under Appearance > Widgets but also a Homepage widget area. Both are empty.

  6. Martin1
    Member
    Posted 3 years ago #

    Your solution didn't change anything Chip.

    I am still as stuck as I was.

  7. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    If you don't have any Widgets defined in either of your Widgetized Sidebars, then the content you're seeing, that you want to remove, is not a Widget.

    It is being added some other way.

  8. Martin1
    Member
    Posted 3 years ago #

    I think there is a miscommunication here:-).

    I don't see any content.
    I want to add content.
    However the only way I can currently add content is by adding a widget to the homepage widget area and placing content in that widget.

    That is what I do not want, because I then don't have access to the wysiwyg editor.

    I want to add content by just typing my content in the Homepage wysiwyg editor under Pages > Home.

    I can type whatever I want there but it does not appear on the page because there is some sort of call to content neccessary in the code provided above. This call to content must be placed instead of the code that calls the widget.

  9. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    See Line #28 of your pastebin.

    Your template file is calling the_content();

  10. Martin1
    Member
    Posted 3 years ago #

    You are right but that call calls in content into a slider at the top. That's okay. However I need a new call to content. I now have removed lines 51 to 79 and 81 to 84 and placed between 51-79 the following:
    <?php the_content();?>.

    http://wordpress.pastebin.com/K0GR1Arz

    But all this does is call in the same content that is part of the last slide of the slider at the top.

    How would I go about adding my own new content in this location?

  11. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    The call to the_content(), whether it is called in your "slider" or in another part of the template file, displays whatever you have entered into the content area in the Edit Post screen.

  12. Martin1
    Member
    Posted 3 years ago #

    Hmmmm that would mean I can't get the content I want below the slider because there is no way to differentiate between the content of the slider (just below the header but above the center of the page) and the content of the center part of the homepage.

    These two should be seperated but seem not to be:-(.

  13. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Just off-hand, you could try using the_excerpt() for the slider, and the_content() for the main part of the page.

    This method gives you the advantage of being able to customize the output of the_excerpt() via the Excerpt field on the Edit Post screen.

  14. Martin1
    Member
    Posted 3 years ago #

    Thanks Chip!

    I will have a look and try your suggestion and see where it leads me.

    I highly appreciate your help on this!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.