WordPress.org

Ready to get started?Download WordPress

Forums

Special Recent Posts
[resolved] Unknown code error in template (3 posts)

  1. xrun
    Member
    Posted 2 years ago #

    Hi.
    I'm trying to add SRP to my template, showing in a 2 by 4 layout where SRP fills a row left to right before continuing on the next row below.
    I need it to get the posts from cat 82, to determine how many posts are in the cat, and to increase the SRP post offset by 1 after showing a post. It needs to keep making new rows until it has displayed 8 posts. That should result in a table 4 rows high.

    I belive I'm getting close to a solution for this, but it seems I'm getting a PHP error on the line containing endwhile; endif;.
    Would someone be so kind and have a look at this and lend a hand?

    <?php //Get post count and set offsetcount to 0
    $count = get_category(82)->count ; $offsetcount= 0 ; ?>
    
    <tbody><table><tr>
    <?php //Start and loop query while cat has posts and number of shown posts are less than 8, place it in 2 table columns
    	if(($offsetcount < 8) && ($offsetcount < $count)) : while (($offsetcount < 8) && ($offsetcount < $count)) { ?>
    <td style="width: 50%;" align="left" valign="top">
    
    <?php
    // Defining SRP options.
    $args = array(
        'srp_number_post_option'  => 1,
        'srp_thumbnail_option'    => 'yes',
        'srp_thumbnail_wdg_width' => '200',
        'srp_thumbnail_wdg_height' => '140',
        'srp_title_hide' => 'yes',
        'srp_wdg_excerpt_length_mode' => 'chars',
        'srp_wdg_excerpt_length' => '230',
        'srp_filter_cat_option' => '82',
        'srp_wdg_excerpt_length' => '230',
        'srp_post_global_offset_option' => $offsetcount,
        'srp_wdg_excerpt_length' => '230',
    );
    		if(function_exists('special_recent_posts')) {
    			special_recent_posts($args);
    		};
    ?>
    <?php //Add 1 to offsetcount before closing table column
    $offsetcount = $offsetcount + 1 ;  ?>
    </td>
    <?php	    endwhile; endif; ?>
    </tr></tbody></table>

    http://wordpress.org/extend/plugins/special-recent-posts/

  2. Luca Grandicelli
    Member
    Plugin Author

    Posted 2 years ago #

    If you get the PRO version, multi-column layout is available with no more effort.

  3. xrun
    Member
    Posted 2 years ago #

    Yes, I asked you about multi-column support here 3 days ago:
    Special Recent Posts PRO - Comments

    Your reply was that SRP PRO fills up every row in one column first, before continuing to the next column. I need it to fill every column in a row first, before moving down to the next row. So where you have multicolumn support which prioritizes the column, I need multirow support to prioritize the row for this project.
    May seem like the same thing, but when your viewing recent projects in a 2x4 layout then the post next to last may look like nr. 5 because it gets put in the first column in the second row, and the last page would not have contents in its full width until the last column gets filled up. Of course you may work around that with offset, but then you'd be back to using several instances again, like I'm working on here.

    You also told me that it does not support pagination at the moment. I'm actually working on some code that might add pagination support to SRP PRO when it is finished. For now though, I just need to finish the work started in the code above.

    It is a very nice plugin, but it doesn't do exactly what is needed for my friends page yet, so I'm trying to work it out.

    BTW: having gotten some sleep since the first post above here, I realize exerpt length is defined three times.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic