WordPress.org

Ready to get started?Download WordPress

Forums

Widget in main body (static page) (27 posts)

  1. sambo26
    Member
    Posted 1 year ago #

    hi everyone

    this has no doubt been asked a million times but i have been searching the net now for a while and cant seem to find what im looking for.

    i would like my "recent posts" to appear in my main body of my static home page, but as i cant put a widget there i was wondering if there is a way to do this,

    i dont know hardly anything about code writing so im really struggling.

    any help would be great thanks

  2. CedarPointConcepts
    Member
    Posted 1 year ago #

    You could use a shortcode. There are a few post shortcode plugins. Here is one:

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  3. sambo26
    Member
    Posted 1 year ago #

    im looking to have a widget box for the posts if that makes sense? all im getting at the min is the text of the post title

  4. cinghaman
    Member
    Posted 1 year ago #

    What you can do is, you can create a custom widget in your functions.php
    Once you do that it would appear on your appearance > widgets add the recent post widget on it
    and than calling that widget on your static page using get_sidebar(widget-name) function.

  5. sambo26
    Member
    Posted 1 year ago #

    is there a tutorial for this?

  6. CedarPointConcepts
    Member
    Posted 1 year ago #

    Yes you could do as Robin stated but you indicated you were new to coding. That is why I suggested using a shortcode. I mentioned that there were a few plugins available. A simple search found this one:

    http://wordpress.org/extend/plugins/posts-for-page/

  7. cinghaman
    Member
    Posted 1 year ago #

    Not sure about exact tutorial but it generally is not that hard
    a sidebar-widget function would look like

    if ( function_exists('register_sidebar') ) {
    
    	register_sidebar(array(
    
    		'id' => 'post-sidebar',
    
    		'name' => 'Recent Post',
    
    		'before_widget' => '<div class="col %2$s" id="%1$s">',
    
    		'after_widget' => '</div>',
    
    		'before_title' => '<h2>',
    
    		'after_title' => '</h2>'
    
    	));

    And than on your static page (once you have added the recent post widget through (appearance > widgets )
    just add a DIV tag where you would want to display it

    <div id="your-post">
    <?php if (is_active_sidebar('post-sidebar')) : ?>
    </div>
  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    search result only, not used it myself, untested:

    there might be a usable plugin:
    http://wordpress.org/extend/plugins/widgets-on-pages/

    http://wordpress.org/extend/plugins/search.php?q=widget+on+pages

  9. sambo26
    Member
    Posted 1 year ago #

    ok cheers for that i finally have the widgets in my main body, im now having toruble getting them to sit side by side.

    they are currently stacking on top of each other

  10. cinghaman
    Member
    Posted 1 year ago #

    Sambo26 what exactly did you use, and can you post link so we can exactly see whats the problem.

  11. sambo26
    Member
    Posted 1 year ago #

    my site isnt live at the moment, i used this http://wordpress.org/extend/plugins/search.php?q=widget+on+pages

  12. cinghaman
    Member
    Posted 1 year ago #

    Mostly if they are stacking it would a css thing -- Ul/LI line-height or bottom margin

  13. sambo26
    Member
    Posted 1 year ago #

    cheers robin i have managed to sort it, now once again i have another issue haha

    trying to put the widgets i have created to be in a stylish box rather than just open

  14. cinghaman
    Member
    Posted 1 year ago #

    rather than just open

    Didnt understand it? can you printscreen and upload image somewhere to exactly show what you mean

  15. sambo26
    Member
    Posted 1 year ago #

    [IMG]http://i1083.photobucket.com/albums/j388/wall_2/ScreenShot2012-11-18at211812.png[/IMG]

  16. sambo26
    Member
    Posted 1 year ago #

  17. cinghaman
    Member
    Posted 1 year ago #

    What i can understand from this is you just need to put a div with css styling around your recent post section

  18. cinghaman
    Member
    Posted 1 year ago #

    you can firebug it and see which class it has

  19. sambo26
    Member
    Posted 1 year ago #

    yeh thats correct

  20. sambo26
    Member
    Posted 1 year ago #

    i will be honest i dont know how to do that

  21. sambo26
    Member
    Posted 1 year ago #

    this is the htm code for when i highlight it in view source

    <div class="widget otw-widget-1 widget-first advanced_recent_posts_widget" style="width: 50%;"><h2 class="widgettitle">Recent Posts</h2>

    </div>

  22. cinghaman
    Member
    Posted 1 year ago #

    There is an extension for your browser called firbug
    (https://getfirebug.com/firebuglite)

  23. cinghaman
    Member
    Posted 1 year ago #

    So this would be your class which you can use to style the div
    something like (this is just an example you would have to css it the way you want)

    .advanced_recent_posts_widget
    {
    border:1px solid #000;
    padding:5px;
    }
  24. sambo26
    Member
    Posted 1 year ago #

    and where would i put that exactly?

  25. cinghaman
    Member
    Posted 1 year ago #

    Generally we create a child theme(the ideal option)
    But you can put that in your theme-folder/style.css
    you might have to play around with something like
    color:#FFF !important;

    The important tag as it will help you overright any default styling

  26. sambo26
    Member
    Posted 1 year ago #

    ok cool, this is a lot for me to take in, it might take me a while to do this, but thanks for the help

  27. cinghaman
    Member
    Posted 1 year ago #

    cheers
    Generally it is good if we can get some access (may be putting the site on dev sever) it makes the support much easier.

Topic Closed

This topic has been closed to new replies.

About this Topic