• hi
    I want my sidebar to display 4 of the most recent posts and comments so I added the two built-in widgets but the problem is that the mark-up isn’t even close to what I need

    using my functions.php I’ve added

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
            'before_widget' => '',
            'after_widget' => '',
            'before_title' => '<h1 class="cyan">',
            'after_title' => '</h1>',
        ));
    ?>

    but that’s only about 10% percent of the markup that I need…
    the widgets return the following HTML code

    <h1 class="cyan">Najnowsze komentarze</h1>
    <ul id="recentcomments">
    <li class="recentcomments">Qbs o <a href="https://fortywinks.pl/kkk/?p=16#comment-7">Lorem ipsum dolor sit amet</a></li>
    <li class="recentcomments">kolejny test o <a href="https://fortywinks.pl/kkk/?p=1#comment-6">Witaj, ?wiecie!</a></li>
    <li class="recentcomments">admin o <a href="https://fortywinks.pl/kkk/?p=1#comment-5">Witaj, ?wiecie!</a></li>
    <li class="recentcomments">test o <a href="https://fortywinks.pl/kkk/?p=1#comment-4">Witaj, ?wiecie!</a></li>
    </ul>

    and I’d like to have such a markup:

    <h1 class="cyan">Najnowsze komentarze</h1>
                    <div class="box">
                    	<ul>
                        	<li class="comments"><a href="#">Lorem ipsum dolor sit amet.</a></li>
                            <li class="comments"><a href="#">Lorem ipsum dolor sit amet.</a></li>
                            <li class="comments"><a href="#">Lorem ipsum dolor sit amet.</a></li>
                            <li class="comments"><a href="#">Lorem ipsum dolor sit amet.</a></li>
                        </ul>
                    </div>
                <div class="sideLine">&nbsp;</div>

    those <li class=””> are essential because I need a different class for the comments and another for posts

    please help!
    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter qbs

    (@qbs)

    I’ve tried this solution from – https://codex.www.ads-software.com/Widgetizing_Themes

    function widget_mytheme_search() {
    ?>
        << PASTE YOUR SEARCH FORM HERE >>
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
        register_sidebar_widget(__('Search'), 'widget_mytheme_search');

    but I can’t get it to work even with this basic example :/

    Thread Starter qbs

    (@qbs)

    bump…

    Thread Starter qbs

    (@qbs)

    bump…

    `<?php
    if ( function_exists(‘register_sidebar’) )
    register_sidebar(array(
    ‘before_widget’ => ”,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h1 class=”cyan”>’,
    ‘after_title’ => ‘</h1> <div class=”box”>’,
    ));
    ?>

    try this hope it works

    Thread Starter qbs

    (@qbs)

    needle189: thanks but that’s not all because still I need to add classes to

    • elements
      <li class="comments"> for the recent comments
      `<li class=”posts”> for the recent posts

    hey if you want to use the widget system then I am afraid it’s not possible. You have to create your own separate code block, I am afraid, if you want to have custom styling for recent comments and recent posts section

    regards

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘customizing sidebar widgets – how?!’ is closed to new replies.