swollenpickles
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Displaying children of page with specific page idthanks I’ll take a look at that tonight.
Forum: Fixing WordPress
In reply to: Displaying children of page with specific page idI was thinking something like this, but can’t get it functioning:
<?php if (is_page('Portfolios')) { $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; if($count >= 2) break; $count++; $content = apply_filters('the_content', $content); ?> <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2> <div class="entry"><?php echo $content ?></div> <?php } } else { <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> </div> <?php endwhile; endif; ?> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> <?php } ?>
Forum: Fixing WordPress
In reply to: Displaying children of page with specific page idThanks. It’s not so much the thumbnail thing I’m having problems with, but more how to display the children of the page if the page has a specific title (eg. Portfolios).
Forum: Fixing WordPress
In reply to: Setting number of posts per category pageThank you Michael, that worked a treat!
Forum: Plugins
In reply to: Using custom field to display images in postThank you for the reply. I replaced the dashes with underscores and it works a treat now.
Forum: Plugins
In reply to: Using custom field to display images in postThanks, here’s the revised page code I’m using:
<?php get_header(); ?> <?php get_sidebar(); ?> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $sample-image = get_post_meta($post->ID, 'sample-image', $single = true); ?> <div id="sample-image"> <?php // if there's a thumbnail if($sample-image !== '') { ?> <p> <img src="<?php echo $sample-image; ?>" /> </p> <?php } ?> </div> <div class="post-single" id="post-single-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> <?php the_tags( '<p>Tags: ', ', ', '</p>'); ?> <p class="postmetadata alt"> <small> Filed under <?php the_category(', ') ?>. </small> </p> </div> </div> <div class="navigation"> <div class="alignleft"><?php previous_post_link('« %link') ?></div> <div class="alignright"><?php next_post_link('%link »') ?></div> </div> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <?php get_footer(); ?>
I’m getting this error message when attempting to view a single post:
Parse error: parse error, unexpected ‘=’ in \themes\template\single.php on line 8This is line 8:
<?php $sample-image = get_post_meta($post->ID, 'sample-image', $single = true); ?>
Forum: Themes and Templates
In reply to: Same post content, different URLSBump, cos I still can’t figure this out.
Forum: Themes and Templates
In reply to: Same post content, different URLSAnyone?
Forum: Fixing WordPress
In reply to: Displaying post extracts from specific category using loopAnyone?
Forum: Themes and Templates
In reply to: looping through child categoriesbump?
Forum: Themes and Templates
In reply to: Creating drop down category menu displaying ‘child’ categories.Thanks for the reply. It looks like I’ve figured it out!
Just to clarify in case anyone else is trying to do something similar, my category structure currently looks like this.
Parent Category 1
– cat 1 child 1
– cat 1 child 2Parent Category 2
– cat 2 child
– cat 2 child 2In my dropdown menu I wanted to display the listing of all children under parent category 1 for example.
Here’s what I’ve used.
<form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=7'); ?> <input type="submit" name="submit" value="view" /> </form>
Forum: Plugins
In reply to: Using phpbay within “custom fields”bump?
Forum: Plugins
In reply to: Using phpbay within “custom fields”Any ideas?
Forum: Plugins
In reply to: Problem displaying specific pages/postsCool, thanks. Only problem is, I’m hot sure how to include that in the code to get it to work.
Here’s what I’m working with at the moment:
<h2 class="section-header">Recent Headlines »</h2> <?php // THE SECOND LOOP SHOWING THE ARTICLES AFTER THE FEATURE if (have_posts()) : $i = 1; while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); // CHECKS TO SEE IF THERE'S AN IMAGE FOR THIS POST $thumb = get_post_meta($post->ID, 'Thumbnail', $single = true); // CHECKS TO SEE IF THERE'S A SET ALT TEXT FOR THIS IMAGE $thumb_alt = get_post_meta($post->ID, 'Thumbnail Alt', $single = true); ?> <?php // for controlling the layout of the home pages bottom excerpts up to 10 posts if($i == '1' || $i == '3' || $i == '5' || $i == '7' || $i == '9') { ?> <div class="secondary"> <?php } // endif ?> <div class="<?php if($i % 2 == 0) { echo 'post-right'; } else { echo 'post-left';} ?>"> <div id="post-<?php the_ID(); ?>" class="post"> <h2 class="post-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2> <div class="entry"> <?php if($thumb !== '') { ?> <p> <img src="<?php echo $thumb?>" alt="<?php if($thumb_alt !== '') echo $thumb_alt; else echo the_title; ?>" class="left" /> </p> <?php } ?> <p class="byline"><?php the_time('F jS, Y') ?></p> <?php the_excerpt(); ?> <p><?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> | <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Read full story »</a></p> </div><!-- entry --> </div><!-- post --> </div><!-- post left or right --> <?php // for controlling the layout of the home pages bottom excerpts up to 10 posts if($i == '2' || $i == '4' || $i == '6' || $i == '8' || $i == '10') { ?> </div><!-- secondary --> <?php } // endif ?> <?php $i++; ?> <?php endwhile; endif; ?>