• Resolved my-web

    (@my-web)


    Hello
    I need Show only one post for day and comments in sidebar, withouth widget.
    Can help me?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter my-web

    (@my-web)

    Escuse, i need show post for certain categories in sidebar with the comments on it, or, for extern news I will have the opportunity to add comments in the news.
    It’s possible?

    Thread Starter my-web

    (@my-web)

    Hello how i can show one post for selected category in sidebar??

    One example (doesn’t address your comments):

    <?php
    //get 5 recent posts in categories 3 or 19.  Useful for sidebar or php code widget
        $args=array(
          'showposts'=>5,
          'category__in' => array(3,19),
          'caller_get_posts'=>1
        );
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo '5 recent Posts';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
            <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
           the_content();
          endwhile;
        } //if ($my_query)
      wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    Thread Starter my-web

    (@my-web)

    Thanks it work good, but i need show limitated number of characters and if possible add comment number or “Add reply”, how i can do it?

    1. Replace the_content(); with echo 'this is 40 chars of content >' . substr($post->post_content,0,40);
    2. Template_Tags/comments_popup_link

    Thread Starter my-web

    (@my-web)

    Thanks a lot!!!

    whitehats

    (@whitehats)

    This is awesome, thanks!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show only one post for day and comments in sidebar’ is closed to new replies.