• Hi all,

    I would like to associate a category to a table. I’ve created a category called BREVES and I want that all posts that I include in this category appear just in this table.

    It is possible?

    Thanks all

    https://flanynata.com/

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php global $more; $more = 0; ?>
    <table class="breves-posts">
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $count=0;
    		 if(query_posts("showposts=10&category_name=BREVES&orderby=date&order=DESC&paged=$paged")) : ;
    		while(have_posts()) : the_post(); ?>
     	<tr>
            <td class="breves-item">
                <a href="<?php the_permalink(); ?>">
                    <?php if( has_post_thumbnail() ) { ?>
                        <?php the_post_thumbnail(); ?>
                    <?php } else { ?>
                    <?php } ?>
                    <h1 class="title"><?php the_title(); ?></h1>
                    <span class="date"><?php the_time('F j, Y', '', ''); ?></span>
                    <span class="content"><?php the_content(); ?></span>
                </a>
            </td>
    	</tr>
    	<?php endwhile; endif; ?>
    </table>
    
    <!-- add your themes pagination function here -->
    <?php wp_reset_query(); ?>

    The above code will call posts in the category “BREVES”. This is accomplished by the part of the code that reads “category_name=BREVES”.

    The posts will be ordered by date and in descending order.

    The featured image is called by this:

    <?php if( has_post_thumbnail() ) { ?>
    <?php the_post_thumbnail(); ?>
    <?php } else { ?>
    <?php } ?>

    Below that is the code for the title, date and content.

    These posts will also be paged with 10 posts per page. You can change the number of posts per page by changing “showposts=10” to any number you want. In order for the pagination numbers to show up, remove the commment seen below and add your themes pagination code:
    <!-- add your themes pagination function here -->

    You can style the posts with CSS and make them look any way you want.

    Thread Starter FlanNataAdmin

    (@flannataadmin)

    Thank you very much. Just one question: what is and how can I find the themes pagination function?

    Thanks again for your time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Associate a category to a table’ is closed to new replies.