Offset Not working

8 views
Skip to first unread message

Jared Olson

unread,
Feb 4, 2014, 9:33:09 PM2/4/14
to wp...@googlegroups.com
Hello,

I am working on a site someone else setup, and the client is wanting the site to have the thesis website show the latest posts in a certain category at the bottom of the page side by side.  I have it where I can show them side by side, but for some reason I cannot figure out how to get the offset to work in the current code they have setup.  Kind of limited code works within the thesis hook for some reason.

<div id="clearer"></div>
<div id="beforefooter" >
<?php
if (is_page(array ( 'legal-services', 'employee-benefits', 'legal-update' ))) {
recent_posts('prefix=<div class="poster"><h3>Latest Legal News</h3>&included_cats=3&suffix=</div>&limit=1&output_template=<p class="feat_headline"><a href="{url}">{title}</a></p><p>{snippet:250:word}...<a href="{url}">read more</a></p>'); ?>
<?php recent_posts('prefix=<div class="poster-right poster"><h3>Latest Legal News</h3>&included_cats=3&suffix=</div>&limit=1&offset=1&output_template=<p class="feat_headline"><a href="{url}">{title}</a></p><p>{snippet:250:word}...<a href="{url}">read more</a></p>');
} elseif (is_page( '' )) {
    echo "a is equal to b";
}
?>
</div> 
Any help is greatly appreciated.  Have been diving into this for way too long.  The second section needs to show the 2nd latest post of that section.  
 

Brian Richards

unread,
Feb 5, 2014, 10:38:51 AM2/5/14
to wp...@googlegroups.com
Hey Jared, it looks like recent_posts() is a function unique to Thesis, so I'm not sure how much any of us can help with that. WP has it's own wp_get_recent_posts() function which is basically just a wrapper for get_posts().

But, I don't think you need to go about running two separate queries on this page, with one being a mere continuation of the other. Instead, you could just run one query and split the output in half. It would be especially simple given your intended markup, here. You could just delete the second instance of recent_posts(), move your prefix and suffix parameters into the output_template parameter, and increase the limit to 2.

Another alternative might be something like this: https://gist.github.com/d7d03843d0e419542b6b

Grace and Peace,
Brian Richards


--
You received this message because you are subscribed to the Google Groups "WordPress Grand Rapids (WPGR)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wpgr+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jared Olson

unread,
Feb 5, 2014, 12:25:50 PM2/5/14
to wp...@googlegroups.com
Hi Brian,

Thank you so much for the quick and very detailed response.  I tried what you put in Github, cut I am always running into the issue of the <?php the_excerpt(); ?> not working within the Thesis loop.

I am messing around with moving the prefix and suffix parameters. That seems to be getting me close. Now need to try and get some CSS changing it to look correct and figure out why it moved the sidebar adding the div in, but I think I am getting a lot closer. Your php worked great accept for the <?php the_excerpt(); ?>. Not sure why that aspect does not work in the thesis hook. Starting to hate thesis right now. Thanks again.

Brian Richards

unread,
Feb 5, 2014, 12:47:59 PM2/5/14
to wp...@googlegroups.com
Thesis is pretty awful. You're not alone in your hatred :)

Grace and Peace,
Brian Richards


Jared Olson

unread,
Feb 5, 2014, 12:54:24 PM2/5/14
to wp...@googlegroups.com
Glad I am not alone.  Thanks again.  
Reply all
Reply to author
Forward
0 new messages