10sexyapples
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Query database for multiple post typesThank you so much for the explanation … learning every day ??
I’m using the same types of applications as both of you above with the nightly builds of 3.0. The custom post type code is still being wrangled around and really isn’t set yet, so, using the plugins currently that are dealing with them will limit you to whatever was available at the time they were written. I have yet to find a plugin UI that is complete enough to implement, so, I am rolling my own in the functions file until the dust settles. It sounds like both of you need the page-attributes option in the supports array and don’t have it, so it is defaulting to post, and as you know there is no option to designate a custom template in the post editor. If you are looking to have a single page template, then you can create one by naming it single-customposttypename.php and it will override single.php. Otherwise you will need to add the page-attributes in the support array. Here’s an example:
register_post_type( 'lessons', array( 'label' => __('Lesson Plans'), 'public' => true, 'show_ui' => true, 'supports' => array( 'title', 'editor', 'author', 'page-attributes', 'thumbnail', 'excerpt', 'revisions') ) );
code is a little weird looking, but, you get the point right?
Forum: Fixing WordPress
In reply to: Post query and pagination problemMan, I’ve been reading the forums for years and people always seem so helpful. Figures … the first time I actually need help myself, and it’s like a ghost town out there. Anybody? Pretty please??? I’m so totally baffled over this and have been going around and around trying to figure out why not one combination of solutions will work. Should it really be that difficult to have one post styled differently show up on the first page of an archive, then have four posts on all remaining archive pages? I guess when you get a page conditional, page less than two – else, together with different post query in each – and css styling unique to each it’s too explosive a combo? Common, I know there is a genius out there somewhere that knows exactly what I’m doing wrong and just can’t wait to help tackle this … sugar on top and everything ….
Thank you t31os_, I am using your code fix on several of my templates to show one post on first page of the archive with custom styling and then 4 posts_per_page on the following archive pages. Everything works fine for page one and page two of the archive, but then it won’t page past page 2 for some reason. I’ve posted this issue in several places here, and have spent at least a weeks time trying to fix this and haven’t been able to come up with anything at all. I figured you might be able to enlighten me as to what is causing this and help me get it sorted. It’s really got me pulling my hair out, so, any help at all would be GREATLY appreciated … from anyone.
Here is my code:
<div id="content" class="fullpage clearfix color-block"> <?php $page_title = category_description("", false); ?> <h3 class="pagetitle float"><?php echo $page_title; ?></h3> <?php $paged = (get_query_var('paged') && get_query_var('paged') > 1) ? get_query_var('paged') : 1; $cat = (get_query_var('cat')) ? get_query_var('cat') : 0; $offset = ($paged > 1) ? ($per_page * ($paged - 1) + 1) - $per_page : 0; $show = ($offset == 0) ? 'posts_per_page=1' : 'posts_per_page=4'; query_posts("paged=$paged&cat=$cat&offset=$offset&$show"); ?> <?php if ( $paged < 2 ) { ?> <div id="nav"><?php posts_nav_link(' ', '<img src="' . get_bloginfo('template_url') . '/images/navigation/larrow.png" />', '<img src="' . get_bloginfo('template_url') . '/images/navigation/rarrow.png" />'); ?></div> <div class="clear"></div> <div id="towerL"> <?php slidepress_display_gallery('');?> </div><!--close towerL--> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="towerR"> <div class="post" id="post-<?php the_ID(); ?>"> <div class="entry"> <?php the_content ("Continue reading " . the_title('', '', false)); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <!--close entry--> </div> <!--close post--> <?php endwhile; endif; ?> </div><!--close TowerR--> <div id="bottom-block"> <div class="draggable-header">/stuff/</div> </div><!--close bottom-block--> <?php } else { ?> <div id="nav"><?php posts_nav_link(' ', '<img src="' . get_bloginfo('template_url') . '/images/navigation/larrow.png" />', '<img src="' . get_bloginfo('template_url') . '/images/navigation/rarrow.png" />'); ?></div> <div class="clear"></div> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="block_big"> <div class="boxgrid caption"> <?php if ( function_exists( 'get_the_image' ) ) { get_the_image( array( 'custom_key' => array( 'Exhibition_Image' ), 'default_size' => 'full', 'width' => '450', 'height' => '190', 'default_image'=> get_bloginfo('wpurl') . '/wp-content/uploads/Defaults/defaultexhibitionimage.jpg', 'image_class' => 'exhibitionimage' ) ); } ?> <div class="cover boxcaption"> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <div class="post" id="post-<?php the_ID(); ?>"> <div class="entry"> <p><?php excerpt('57'); ?><p> </div><!--close entry--> </div><!--close post--> </div><!--close cover boxcaption--> </div><!--close boxgrid--> </div><!--close block--> <?php endwhile; ?> <?php endif; ?> <?php } ?> </div><!--close content--> </div> <!--close innerwrap--> <?php get_footer(); ?>
Forum: Fixing WordPress
In reply to: Query_posts, offset and paginationt31os_ I’m hoping you’ll see this posted here. This issue is somewhat similar to an issue I’m having, so, thought I would give it a try, and it seems every time I’m in dire need of assistance, it is you that has had the answer I was looking for. My issue is that I have a category archive that isn’t playing nice.
Here it is:
?I need to display one specific post, in full, on page 1 of the archive – it needs to be called in by ID as I can’t use the sticky fix to have it always show there ( I’m using sticky to call in featured posts on the homepage)
?I need navigation on page one to the remainder of the category posts.
?Page two and on, need to exclude the post on page one and show 4 posts per page.Here is what I thought was my almost working solution ( still needed to figure out how to call in the same post always on first page ):
<?php $per_page = get_option('posts_per_page'); $paged = (get_query_var('paged') && get_query_var('paged') > 1) ? get_query_var('paged') : 1; $cat = (get_query_var('cat')) ? get_query_var('cat') : 0; $offset = ($paged > 1) ? ($per_page * ($paged - 1) + 1) - $per_page : 0; $show = ($offset == 0) ? 'posts_per_page=1' : 'posts_per_page='.$per_page; query_posts("paged=$paged&cat=$cat&offset=$offset&$show"); ?> <?php if ( $paged < 2 ) { ?> <div id="nav"><?php posts_nav_link(' ', '<img src="' . get_bloginfo('template_url') . '/images/navigation/larrow.png" />', '<img src="' . get_bloginfo('template_url') . '/images/navigation/rarrow.png" />'); ?></div> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> //stuff// <?php endwhile; endif; ?> <?php } else { ?> <div id="nav"><?php posts_nav_link(' ', '<img src="' . get_bloginfo('template_url') . '/images/navigation/larrow.png" />', '<img src="' . get_bloginfo('template_url') . '/images/navigation/rarrow.png" />'); ?></div> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> /stuff/ <?php endwhile; endif; ?> <?php } ?>
Unfortunately, what I discovered is that one post is being excluded from being shown. There should be six posts total, one on the front page and four on page two, leaving only one ( for now until more are posted ) on page 3. What I am getting is one on page one, and four on page two. The last post is missing. And it is the last post that is missing, not the first, so, I’m baffled. Any wisdom you could give would be greatly appreciated of course, and thank you in advance if you get a chance to help me out here~
Forum: Fixing WordPress
In reply to: Troubles using wp_list_pagesI am experiencing this same issue, and have found several unanswered topics on this scattered all the way back to 2005. Can anyone shed some light on how to deal with this and facilitate using the wp_list_pages function twice? My main header navigation is a list of pages, and now, I need to have a page whose template carries a completely different list of pages within it, and for the life of me can’t find any solutions to make this possible. I read a post from a while back about someone uncaching the list pages function so that they could use it twice, but, does it really take doing this? Any help would be greatly appreciated.
Thank you,
Angie